nagios监控iptables状态(二)
由于上一篇上面写的那个脚本不是很好用,每次加了防火墙规则以后都需要手动删除MD5文件。所以重新写了一个shell,通过计算他的规则条数来判断iptables是否做了修改!1
2
3
4
5
6
7
8
9
10
#!/bin/bash
iptable_num=$(sudo /sbin/iptables -L -n|wc -l)
if [ ${iptable_num} = 8 ];then
echo iptables is stoped
exit 1
else
echo iptables is started $iptable_num
exit 0
fi
如果各位大神有什么好的方法欢迎推荐。谢谢!
页:
[1]