|
- 安装了zabbix(此步骤跳过) 本机的Ip是:59.110.26.9
2.创建脚本目录
[root@web02 ~]# cd /etc/zabbix/
[root@web02 zabbix]# mkdir shells 3.上传zabbix UserParameter需要调用的脚本
[root@web02 zabbix]# cd shells/
[root@web02 shells]# ll
total 4
-rwxr-xr-x 1 root root 2854 Jan 28 12:12 zabbix_linux_plugin.sh
[root@web02 shells]# pwd
/etc/zabbix/shells
[root@web02 shells]#
[root@web02 shells]# chmod +x zabbix_linux_plugin.sh 4.编写调用的agent UserParameter
[root@web02 shells]# cd /etc/zabbix/zabbix_agentd.d/
[root@web02 zabbix_agentd.d]# ls
userparameter_mysql.conf zabbix-linux-plugin.conf
[root@web02 zabbix_agentd.d]#
[root@web02 zabbix_agentd.d]# cat zabbix-linux-plugin.conf
UserParameter=linux_status
,/etc/zabbix/shells/zabbix_linux_plugin.sh "$1" "$2" "$3"
[root@web02 zabbix_agentd.d]#
注意:上面的步骤配置完毕以后 要重启zabbix-agent 服务 5.服务端测试(zabbix-server端)
[root@web02 zabbix_agentd.d]# zabbix_get -s 59.110.26.9 -k linux_status[tcp_status,ESTAB]
/etc/zabbix/shells/zabbix_linux_plugin.sh: line 14: /tmp/netstat.tmp: Permission denied
4
[root@web02 zabbix_agentd.d]#
解决办法:chown zabbix.zabbix /tmp/netstat.tmp
[root@web02 zabbix_agentd.d]# zabbix_get -s 59.110.26.9 -k linux_status[tcp_status,ESTAB]
4 6.zabbix导入模板
7.查看结果(模板默认的300s 生产场景 300s 测试可以修改模板的时间间隔。测试修改为30s)
8.查看出图的结果
|
|
|
|
|
|
|