服务器:Centos7
防火墙服务:iptables
- 在agent端编写脚本iptables_status.sh
#!/bin/bash
stat=`systemctl status iptables | grep Active | awk '{print $3}'`
if [ $stat == running ];then
echo 1
elif [ $stat == "(exited)" ];then
echo 1
else
echo 0
fi
保存并赋予权限 chmod +x iptables_status.sh
- 验证脚本
- 编辑客户端配置文件,添加监控项键值
vim vim /etc/zabbix/zabbix_agentd.conf
UserParameter=check.iptables,/data/shao_zhuang/iptables_status.sh
- 重启zabbix-agent
systemctl restart zabbix-agent
-
进入zabbix服务器端页面,在使用的模板里添加监控项
-
建相关触发器