agent端:
zabbix 自定義指令碼
[root@localhost script]# cat check_ping.sh#!/bin/bash
result=$(/usr/local/nagios/libexec/check_icmp -s $1 $2
)a=$(echo $result | awk''
)if [ $a == "
ok" ];then
echo
"0000
"else
echo
"2222"fi
[root@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=,# see
'zabbix_agentd
' directory for
examples.
## mandatory: no
# default:userparameter
=check.icmpping[*],/usr/local/zabbix/script/check_ping.sh $1 $2
++++++++++++++++++++++++++
[root@localhost etc]# /etc/init.d/zabbix_agentd restart
shutting down zabbix_agentd: [ ok ]
starting zabbix_agentd: [ ok ]
[root@localhost etc]#
在服務端使用命令檢測自定義key是否可行:
[root@localhost ~]# zabbix_get -s 172.16.8.11 -p 10050 -k "check.icmpping[172.16.8.11,172.16.8.12]
"0000
[root@localhost ~]# zabbix_get -s 172.16.8.11 -p 10050 -k "
check.icmpping[172.16.8.11,192.168.1.2]
"zbx_notsupported
[root@localhost ~]#
從上面可以看出,對於不通的值zabbix服務端始終取不到值,出現zbx_notsupported
zabbix取不到值得解決辦法:
修改agent端的超時時間並重啟agent服務:
### option: timeout# spend no
more
than timeout seconds on processing
## mandatory: no
# range:
1-30
# default:
#timeout=3
timeout=8
[root@localhost etc]# /etc/init.d/zabbix_agentd restart
shutting down zabbix_agentd: [ ok ]
starting zabbix_agentd: [ ok ]
[root@localhost etc]#
在server端再次測試:
[root@localhost ~]# zabbix_get -s 172.16.8.11 -p 10050 -k "check.icmpping[172.16.8.11,172.16.8.12]
"0000
[root@localhost ~]# zabbix_get -s 172.16.8.11 -p 10050 -k "
check.icmpping[172.16.8.11,192.168.1.2]
"2222
[root@localhost ~]#
zabbix自定義指令碼監測
1.在agent 建立指令碼 建立檔案 etc zabbix scripts ftp count.sh bin bash netstat a grep ftp grep c v listen加許可權 chmod 755 etc zabbix scripts ftp count.sh 2.在agent...
zabbix自定義監控
1 監控資料備份情況 主動模式 1 資料備份及傳送成功 1 2 資料匯入成功 1 2 在zabbix agent客戶端配置如下 root zagent zabbix cat etc zabbix zabbix agentd.conf startagents 0 設定該值為0,則agent不會監聽本地...
Zabbix 自定義監控項
vi usr local zabbix etc zabbix agentd.conf unsafeuserparameters 1 userparameter check process,echo top b n 1 grep mysqld awk f server 192.168.1.12 然後r...