[iyunv@localhost script]# sh check_ping.sh 172.16.8.11 www.baidu.com
0000
[iyunv@localhost script]#
[iyunv@localhost script]# sh check_ping.sh 172.16.8.11 www.nimeiakao.com
2222
[iyunv@localhost script]
修改zabbix_agentd.conf配置并重启服务:
+++++++++++++
### 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
### 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=check.icmpping
,/usr/local/zabbix/script/check_ping.sh $1 $2
++++++++++++++++++++++++++
[iyunv@localhost etc]# /etc/init.d/zabbix_agentd restart
Shutting down zabbix_agentd: [ OK ]
Starting zabbix_agentd: [ OK ]
[iyunv@localhost etc]#
在服务端使用命令检测自定义key是否可行: