zabbix user-defined item
Posted 吴悟无
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了zabbix user-defined item相关的知识,希望对你有一定的参考价值。
1、user-defind item at:/etc/zabbix/zabbix_agent.conf
format: UserParameter=<key>,<command>
UnsafeUserParameters=1
UserParameter=memory.free,/usr/bin/free | awk ‘/^Mem/{print $4}‘
UserParameter=memory.info[*],/bin/cat /proc/meminfo | awk ‘/^$1/{print $$2}‘
UserParameter=load.info[*],/etc/zabbix/key/load_info.py $1
2、item at frontend
format: key <key> note: <key> should be the same as zabbix_agent.conf key:load.info[LoadOneMin]
3、user-defind script: load_info.py
# -*- coding: UTF-8 -*-
import sys
import os
para = None
try:
para = sys.argv[1]
except Exception as e:
print("please input para, like ‘LoadOneMin‘")
if para == "LoadOneMin":
LoadOneMin = os.system("uptime | awk -F‘,| +‘ ‘{print $14}‘")
elif para == "LoadFiveMin":
LoadOneMin = os.system("uptime | awk -F‘,| +‘ ‘{print $16}‘")
elif para == "LoadFifthMin":
LoadOneMin = os.system("uptime | awk -F‘,| +‘ ‘{print $18}‘")
else:
print("please input para, like ‘LoadOneMin‘")
以上是关于zabbix user-defined item的主要内容,如果未能解决你的问题,请参考以下文章
Zabbix 自定义Item经常Not Supported解决