Random Project

Needs Root Access

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