root@(none):/etc/zabbix/zabbix_agentd.conf.d# grep -v "^$" /etc/zabbix/zabbix_agentd.conf|grep -v "^#" PidFile=/var/run/zabbix/zabbix_agentd.pid LogFile=/var/log/zabbix-agent/zabbix_agentd.log LogFileSize=0 Server=127.0.0.1,123.57.36.227#允许那些IP访问本机的key ServerActive=123.57.36.227:10051#主动监控,填服务IP的端口 Hostname=123.56.78.103#客户端的主机名,注意此主机名需要和实际名称一样,且server端可以解析 Include=/etc/zabbix/zabbix_agentd.conf.d/#配置文件,即独立的配置文件 UnsafeUserParameters=1 #开启此项,自定义KEY时候可以增加特殊字符
root@(none):/etc/zabbix/zabbix_agentd.conf.d# pwd /etc/zabbix/zabbix_agentd.conf.d root@(none):/etc/zabbix/zabbix_agentd.conf.d# ls count_line_passwd.conf os_type.conf root@(none):/etc/zabbix/zabbix_agentd.conf.d#
root@(none):/etc/zabbix/zabbix_agentd.conf.d# cat count_line_passwd.conf UserParameter=count.line.passwd,wc -l /etc/passwd|awk '{print $1}' root@(none):/etc/zabbix/zabbix_agentd.conf.d# cat os_type.conf UserParameter=get.os.type,/usr/bin/head -1 /etc/issue
每增加key值都要重启客户端