zabbix使用用户自定义键值来监控应用系统连接数:
1、修改配置文件zabbix_agentd.conf
格式: UserParameter=<key>,<shell command>
加入一行:UserParameter=connections,netstat -n| grep 12345| wc –l
[rusky@zabbix etc]$ pwd
/home/rusky/zabbix/etc
[rusky@zabbix etc]$ ls
zabbix_agent.conf zabbix_agent.conf.d zabbix_agentd.conf zabbix_agentd.conf.d
[rusky@zabbix etc]$ vi zabbix_agentd.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=0 ### Option: UserParameter # User-defined parameter to monitor. There can be several user-defined parameters. # Format: UserParameter=<key>,<shell command> # See 'zabbix_agentd' directory for examples. # # Mandatory: no # Default: # UserParameter=
2、Web界面添加监控项
Name值自己定义,Key值为我们配置文件里的key值Connections,其它参数可默认。
修改完后,点Add添加即可。