vim /usr/local/zabbix/etc/zabbix_agentd.conf
Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/
# Include=/usr/local/etc/zabbix_agentd.conf.d/*.conf
####### USER-DEFINED MONITORED PARAMETERS #######
### Option: UnsafeUserParameters
# Allow all characters to be passed in arguments to user-defined parameters.
# 0 - do not allow
# 1 - allow
#
# Mandatory: no
# Range: 0-1
# Default:
UnsafeUserParameters=1 把上面的include前的注释去掉,这样你的自定义的key就可以放在zabbix_agentd.conf.d这个目录下
[root@localhost zabbix_agentd.conf.d]# ls
userparameter_script.conf #名字自己随便取 你可以在userparameter_script.conf这个文件下自定义key
如下为灵活的用户自定义参数
UserParameter=key
,command
参数
描述
Key
唯一.
表示里面可以传递多个参数
Command
需要执行的脚本,key的[]里面的参数一一对应$1到$9,一共9个参数。$0表示脚本命令
如:UserParameter=get.os.type, head -1 /etc/issue
以上配置完成后重启zabbix_agentd
如果你定义的key比较少就一两个,也可以在zabbix_agentd.conf直接添加
### Option: UserParameter
# User-defined parameter to monitor. There can be several user-defined parameters.
# Format: UserParameter=,
# See 'zabbix_agentd' directory for examples.
#
# Mandatory: no
# Default:
UserParameter=get.os.type, head -1 /etc/issue
UserParameter=custom.vfs.dev.read.ops