Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Check Iptables
0.6.1
2011-02-10
- Nagios 1.x
- Nagios 2.x
- Nagios 3.x
GPL
109619
File | Description |
---|---|
check_iptables_status.sh | 0.6.1 version - Fixes to error handling, and coding mistakes. |
Documentation about iptables: ~:# man iptables
This scripts is intended to be used to check if your iptables rules are set correctly load at any time, I didn't find a better way to check if a server has your rules loaded so I check the number of configured rules and if they are less than they should be Nagios will send an alert using it notify service.
This scripts is intended to be used to check if your iptables rules are set correctly load at any time, I didn't find a better way to check if a server has your rules loaded so I check the number of configured rules and if they are less than they should be Nagios will send an alert using it notify service.
Reviews (1)
Hi...
I managed to get this somewhat operational on the local machine by adding the nagios user to the sudoers file..
nagios ALL= NOPASSWD: /sbin/iptables
Then I added the sudo to the plugin..
CHKIPTBLS=`sudo /sbin/iptables -n -t filter -L |wc -l`
However that only sorted out the local execution environment.. When I try to invoke from the foreign Nagios server, it still doesn't quite execute :(
[The Command]
/usr/local/nagios/libexec/check_nrpe -H {the_other_machine_ip} -c check_iprule_no -a RH-Firewall-1-INPUT 15
[The Output]
CRITICAL - Iptables are CRITICAL The Table RH-Firewall-1-INPUT and Chain has 0 rules configured
However it works nicely on the NRPE local machine..
[Output]
OK - Iptables are OK The Table RH-Firewall-1-INPUT and Chain has 28 rules configured
I managed to get this somewhat operational on the local machine by adding the nagios user to the sudoers file..
nagios ALL= NOPASSWD: /sbin/iptables
Then I added the sudo to the plugin..
CHKIPTBLS=`sudo /sbin/iptables -n -t filter -L |wc -l`
However that only sorted out the local execution environment.. When I try to invoke from the foreign Nagios server, it still doesn't quite execute :(
[The Command]
/usr/local/nagios/libexec/check_nrpe -H {the_other_machine_ip} -c check_iprule_no -a RH-Firewall-1-INPUT 15
[The Output]
CRITICAL - Iptables are CRITICAL The Table RH-Firewall-1-INPUT and Chain has 0 rules configured
However it works nicely on the NRPE local machine..
[Output]
OK - Iptables are OK The Table RH-Firewall-1-INPUT and Chain has 28 rules configured