Nagios Plugin for IPTABLES Monitoring

Percy Kwong psk at psk.net
Fri Jun 21 14:32:30 CEST 2013


adjust your awk statement.  I bet you the output is shifted one field to 
the left or right.

Cheers.

-Percy



On 5/14/2013 4:43 AM, Deborah Martin wrote:
>
> Hi,
>
> What is the wrong output being returned ? This might give us all a 
> clue as to the cause of the problem.
>
> When you run the check manually, are you doing this as the same user 
> that check_nrpe will use ?
>
> Regards,
>
> Deborah
>
> *From:*Thilakraj.Shanmugam [mailto:Thilakraj.Shanmugam at canberra.edu.au]
> *Sent:* 14 May 2013 08:43
> *To:* nagios-users at lists.sourceforge.net
> *Subject:* [Nagios-users] Nagios Plugin for IPTABLES Monitoring
>
> Greetings!
>
> Could someone send me nagios plugin which is tested and works well for 
> monitoring IPTABLES in Linux.
>
> I have tested below script but it is not returning correct output to 
> nagios server.
>
> If I execute script manually, it shows correct output...
>
> But if I execute via  ./check_nrpe -- H localhost --c check_iptables,  
> it shows wrong output.
>
> Below is my plugin
>
> ------------------------------
>
> #!/bin/bash
>
> set -x
>
> IPT='/sbin/iptables'
>
> GREP='/bin/grep'
>
> AWK='/bin/awk'
>
> EXPR='/usr/bin/expr'
>
> WC='/usr/bin/wc'
>
> A='/usr/bin/sudo'
>
> E_SUCCESS="0"
>
> E_CRITICAL="2"
>
> E_UNKNOWN="3"
>
> CHAINS=`$A $IPT -nvL | $GREP 'Chain' | $AWK '{ print $2 }'| $GREP Cid 
> | $WC -l`
>
>                 if [ $CHAINS -ne 0 ] ; then
>
> echo "Firewall is running!"
>
> exit ${E_SUCCESS}
>
>                 elif [ $CHAINS -eq 0 ] ; then
>
> echo "Firewall is not running"
>
> exit ${E_CRITICAL}
>
>                 fi
>
>
> Untitled Document
>
> This e-mail and any files transmitted with it are strictly 
> confidential and intended solely for the use of the individual or 
> entity to whom they are addressed. If you are not the intended 
> recipient, please delete this e-mail immediately. Any unauthorised 
> distribution or copying is strictly prohibited.
>
> Whilst Kognitio endeavours to prevent the transmission of viruses via 
> e-mail, we cannot guarantee that any e-mail or attachment is free from 
> computer viruses and you are strongly advised to undertake your own 
> anti-virus precautions. Kognitio grants no warranties regarding 
> performance, use or quality of any e-mail or attachment and undertakes 
> no liability for loss or damage, howsoever caused.
>
>
>
> ------------------------------------------------------------------------------
> AlienVault Unified Security Management (USM) platform delivers complete
> security visibility with the essential security capabilities. Easily and
> efficiently configure, manage, and operate all of your security controls
> from a single console and one unified framework. Download a free trial.
> http://p.sf.net/sfu/alienvault_d2d
>
>
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20130621/78496c3f/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


More information about the Users mailing list