<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
adjust your awk statement. I bet you the output is shifted one
field to the left or right. <br>
<br>
Cheers.<br>
<br>
-Percy<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">On 5/14/2013 4:43 AM, Deborah Martin
wrote:<br>
</div>
<blockquote
cite="mid:9bfb3d7160274037a5ec1838584ac8db@DBXPR03MB062.eurprd03.prod.outlook.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:"Book Antiqua";
panose-1:2 4 6 2 5 3 5 3 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Hi, <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">What is the
wrong output being returned ? This might give us all a clue
as to the cause of the problem.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">When you run
the check manually, are you doing this as the same user that
check_nrpe will use ?
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Deborah <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF
1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-GB"
lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-GB"
lang="EN-US"> Thilakraj.Shanmugam
[<a class="moz-txt-link-freetext" href="mailto:Thilakraj.Shanmugam@canberra.edu.au">mailto:Thilakraj.Shanmugam@canberra.edu.au</a>] <br>
<b>Sent:</b> 14 May 2013 08:43<br>
<b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:nagios-users@lists.sourceforge.net">nagios-users@lists.sourceforge.net</a><br>
<b>Subject:</b> [Nagios-users] Nagios Plugin for
IPTABLES Monitoring<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-AU"
lang="EN-AU">Greetings!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-AU"
lang="EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-AU"
lang="EN-AU">Could someone send me nagios plugin which is
tested and works well for monitoring IPTABLES in Linux.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-AU"
lang="EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-AU"
lang="EN-AU">I have tested below script but it is not
returning correct output to nagios server.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-AU"
lang="EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-AU"
lang="EN-AU">If I execute script manually, it shows correct
output…<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-AU"
lang="EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-AU"
lang="EN-AU">But if I execute via ./check_nrpe – H
localhost –c check_iptables, it shows wrong output.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-AU"
lang="EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-AU"
lang="EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-AU"
lang="EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-AU"
lang="EN-AU">Below is my plugin<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-AU"
lang="EN-AU">------------------------------<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Book
Antiqua","serif";mso-fareast-language:EN-AU"
lang="EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU">#!/bin/bash<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU">set -x<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU">IPT='/sbin/iptables'<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU">GREP='/bin/grep'<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU">AWK='/bin/awk'<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU">EXPR='/usr/bin/expr'<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU">WC='/usr/bin/wc'<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU">A='/usr/bin/sudo'<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU">E_SUCCESS="0"<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU">E_CRITICAL="2"<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU">E_UNKNOWN="3"<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU">CHAINS=`$A $IPT -nvL |
$GREP 'Chain' | $AWK '{ print $2 }'| $GREP Cid | $WC -l`<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU"> if [
$CHAINS -ne 0 ] ; then<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU">
echo "Firewall is running!"<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU">
exit ${E_SUCCESS}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU"> elif [
$CHAINS -eq 0 ] ; then<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU">
echo "Firewall is not running"<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU">
exit ${E_CRITICAL}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU"> fi<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt" lang="EN-AU"><o:p> </o:p></span></p>
</div>
<br clear="all">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 16px;
}
.style2 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
</style>
<p> <span class="style2">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.<br>
<br>
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.</span><br>
</p>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">------------------------------------------------------------------------------
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.
<a class="moz-txt-link-freetext" href="http://p.sf.net/sfu/alienvault_d2d">http://p.sf.net/sfu/alienvault_d2d</a></pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Nagios-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</a>
<a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/nagios-users">https://lists.sourceforge.net/lists/listinfo/nagios-users</a>
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null</pre>
</blockquote>
<br>
</body>
</html>