Nagios Plugin for IPTABLES Monitoring

Eliezer Croitoru eliezer at ngtech.co.il
Thu May 30 12:56:12 CEST 2013


Or instead use a specific REJECT rule on specific port that otherwise 
will work and test it via a small script that will return if ok or not..
can work like this:
echo server startup on upper ports threaded.
test a client on it.
get result and close both server and client.
can be very simple to do in ruby.

Eliezer

On 5/14/2013 10:42 AM, Thilakraj.Shanmugam wrote:
> 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
>
>
>
> ------------------------------------------------------------------------------
> 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
>


------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
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