<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<title>Untitled Document</title>
<style><!--
/* Font Definitions */
@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;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        mso-fareast-language:EN-US;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        mso-fareast-language:EN-US;}
p.style1, li.style1, div.style1
        {mso-style-name:style1;
        mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Arial","sans-serif";
        font-weight:bold;}
p.style2, li.style2, div.style2
        {mso-style-name:style2;
        mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:9.0pt;
        font-family:"Arial","sans-serif";}
span.EmailStyle23
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle24
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.style21
        {mso-style-name:style21;
        font-family:"Arial","sans-serif";}
span.EmailStyle26
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle27
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.style22
        {mso-style-name:style22;
        font-family:"Arial","sans-serif";}
span.EmailStyle29
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle30
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle31
        {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;}
/* List Definitions */
@list l0
        {mso-list-id:1459376749;
        mso-list-type:hybrid;
        mso-list-template-ids:1203134400 -1382615100 201916441 201916443 201916431 201916441 201916443 201916431 201916441 201916443;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        color:black;
        mso-style-textfill-fill-color:black;
        mso-style-textfill-fill-alpha:100.0%;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1
        {mso-list-id:1634217056;
        mso-list-type:hybrid;
        mso-list-template-ids:1456530262 201916431 201916441 201916443 201916431 201916441 201916443 201916431 201916441 201916443;}
@list l1:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l2
        {mso-list-id:1872378576;
        mso-list-type:hybrid;
        mso-list-template-ids:1203134400 -1382615100 201916441 201916443 201916431 201916441 201916443 201916431 201916441 201916443;}
@list l2:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        color:black;
        mso-style-textfill-fill-color:black;
        mso-style-textfill-fill-alpha:100.0%;}
@list l2:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l2:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l2:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l2:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l2:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l2:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l2:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l2:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></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]-->
</head>
<body lang="EN-AU" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Hello All,<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">Just to add on, I have done some readings and tested other option is    
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l1 level1 lfo3"><![if !supportLists]><span style="color:#1F497D"><span style="mso-list:Ignore">1.<span style="font:7.0pt "Times New Roman"">      
</span></span></span><![endif]><span style="color:#1F497D">open /etc/sudoers file and entry a line as like below<o:p></o:p></span></p>
<p class="MsoListParagraph"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoListParagraph"><span style="font-size:10.0pt">Defaults:nagios !requiretty<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">Note:  It means only nagios user not require a tty, but rest of others have.  I recommend, this is better option<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 lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-AU">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-AU"> Thilakraj.Shanmugam
 [mailto:Thilakraj.Shanmugam@canberra.edu.au] <br>
<b>Sent:</b> Thursday, 25 July 2013 5:37 PM<br>
<b>To:</b> Nagios Users List<br>
<b>Subject:</b> Re: [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="color:#1F497D">Hello All,  <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">I have found the helpful fix after much of struggle, it might be useful someone want to configure and monitor Iptables status.<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">After write your own plugin, then keep it in /usr/local/nagios/libexec dir.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l2 level1 lfo4"><![if !supportLists]><span style="color:black"><span style="mso-list:Ignore">1.<span style="font:7.0pt "Times New Roman"">      
</span></span></span><![endif]><span style="color:#1F497D">open /etc/sudoers file and comment line as like below<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="font-size:10.0pt">#Defaults    requiretty<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="font-size:10.0pt"><o:p> </o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l2 level1 lfo4"><![if !supportLists]><span style="color:black"><span style="mso-list:Ignore">2.<span style="font:7.0pt "Times New Roman"">      
</span></span></span><![endif]><span style="color:#1F497D">End of /etc/sudoers file mention the line as below<o:p></o:p></span></p>
<p class="MsoListParagraph"><span style="font-size:10.0pt"><o:p> </o:p></span></p>
<p class="MsoListParagraph"><span style="font-size:10.0pt">nagios servername= NOPASSWD: /sbin/iptables, /usr/local/nagios/libexec/check_nrpe<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">                Note: Do remember to mention your own server name<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">Now you can test your plugin via check_NRPE and it will give you expected results.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Good Luck!<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">Kind Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Thilakraj Shanmugam<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 lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-AU">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-AU"> Thilakraj.Shanmugam
<br>
<b>Sent:</b> Wednesday, 29 May 2013 3:39 PM<br>
<b>To:</b> Nagios Users List<br>
<b>Subject:</b> RE: 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="color:#1F497D">Hi Deborah et al,<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">I have tested with nagios user as well.. still no luck with that.  Could you some one update if you have any solution on this case.<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">Kind Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Thilak<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 lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-AU">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-AU"> Deborah
 Martin [<a href="mailto:Deborah.Martin@kognitio.com">mailto:Deborah.Martin@kognitio.com</a>]
<br>
<b>Sent:</b> Tuesday, 14 May 2013 7:30 PM<br>
<b>To:</b> Nagios Users List<br>
<b>Subject:</b> Re: [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 lang="EN-GB" style="color:#1F497D">Ok – if I look at your output, manually,  when the plugin is run as the “root” user it produces the correct result.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D">But, you haven’t said what the nrpe user is that is running on the remote node  and whether the same manual run of the check produces the same output.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D">For example, I run remote plugins through nrpe as the “nagios” user so if I want to manually test a plugin on the remote node, I would first login as the nagios user to ensure I’ve got the same environment
 that would be used when running via nrpe. It might be that the variables you have set in the script only work as the root user. It’s never a good idea to test as the root  user but only as the same user as that used by nagios or nrpe.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D">Deborah <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" 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 lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-GB">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-GB"> Thilakraj.Shanmugam
 [<a href="mailto:Thilakraj.Shanmugam@canberra.edu.au">mailto:Thilakraj.Shanmugam@canberra.edu.au</a>]
<br>
<b>Sent:</b> 14 May 2013 09:58<br>
<b>To:</b> Nagios Users List<br>
<b>Subject:</b> Re: [Nagios-users] Nagios Plugin for IPTABLES Monitoring<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Hi Deborah,  Thanks for the response..  please find the details below.<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="font-size:10.0pt">[root@abc libexec]# pwd<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">/usr/local/nagios/libexec<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">[root@abc libexec]# ./check_iptables.sh                                                                       <-----  Executing manually script<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">+ IPT=/sbin/iptables<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">+ GREP=/bin/grep<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">+ AWK=/bin/awk<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">+ EXPR=/usr/bin/expr<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">+ WC=/usr/bin/wc<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">+ A=/usr/bin/sudo<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">+ E_SUCCESS=0<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">+ E_CRITICAL=2<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">+ E_UNKNOWN=3<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">++ /usr/bin/sudo /sbin/iptables -nvL<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">++ /bin/grep Chain<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">++ /bin/awk '{ print $2 }'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">++ /bin/grep Cid<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">++ /usr/bin/wc -l<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">+ CHAINS=5<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">+ '[' 5 -ne 0 ']'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">+ echo 'Firewall is running!'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;background:yellow;mso-highlight:yellow">Firewall is running!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;background:yellow;mso-highlight:yellow">+ exit 0</span><span style="font-size:10.0pt">                                                                                                                   <------ 
 it shows firewall running   ( correct output )<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">[root@abc libexec]#<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><u><span style="font-size:10.0pt">Client - NRPE config file<o:p></o:p></span></u></p>
<p class="MsoNormal"><span style="font-size:10.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">[root@abc libexec]# cat /usr/local/nagios/etc/nrpe.cfg |grep -i iptable<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">command[check_iptables]=/usr/local/nagios/libexec/check_iptables.sh<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">[root@abc libexec]#<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">[root@abc libexec]# ./check_nrpe -H localhost -c check_iptables<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;background:yellow;mso-highlight:yellow">Firewall is not running</span><span style="font-size:10.0pt">                                                                                                        <----- 
 executing via check_nrpe   (  wrong output )<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">[root@abc libexec]#<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">NRPE Logs<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">-------------<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">May 14 18:52:28 abc nrpe[31158]: Added command[check_Partion_db]=/usr/local/nagios/libexec/check_disk -w 15% -c 5% -p /db<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">May 14 18:52:28 abc nrpe[31158]: Added command[check_Partion_app]=/usr/local/nagios/libexec/check_disk -w 15% -c 5% -p /app<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">May 14 18:52:28 abc nrpe[31158]: Added command[check_iptables]=/usr/local/nagios/libexec/check_iptables.sh<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">May 14 18:52:28 abc nrpe[31158]: INFO: SSL/TLS initialized. All network traffic will be encrypted.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">May 14 18:52:28 abc nrpe[31158]: Handling the connection...<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">May 14 18:52:28 abc nrpe[31158]: Host is asking for command 'check_iptables' to be run...<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">May 14 18:52:28 abc nrpe[31158]: Running command: /usr/local/nagios/libexec/check_iptables.sh<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">May 14 18:52:28 abc nrpe[31158]: Command completed with
<span style="background:yellow;mso-highlight:yellow">return code 2 and output: Firewall is not running</span><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">May 14 18:52:28 abc nrpe[31158]: Return Code: 2, Output: Firewall is not running<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">Kind Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Thilak<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 lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-AU">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-AU"> Deborah
 Martin [<a href="mailto:Deborah.Martin@kognitio.com">mailto:Deborah.Martin@kognitio.com</a>]
<br>
<b>Sent:</b> Tuesday, 14 May 2013 6:44 PM<br>
<b>To:</b> Nagios Users List<br>
<b>Subject:</b> Re: [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 lang="EN-GB" style="color:#1F497D">Hi, <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" 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 lang="EN-GB" 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 lang="EN-GB" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D">Deborah <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" 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 lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-GB">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-GB"> Thilakraj.Shanmugam
 [<a 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 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"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-AU">Greetings!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language: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"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language: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"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language: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"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language: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"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-AU">Below is my plugin<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language: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"><o:p> </o:p></span></p>
<p class="MsoNormal">#!/bin/bash<o:p></o:p></p>
<p class="MsoNormal">set -x<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">IPT='/sbin/iptables'<o:p></o:p></p>
<p class="MsoNormal">GREP='/bin/grep'<o:p></o:p></p>
<p class="MsoNormal">AWK='/bin/awk'<o:p></o:p></p>
<p class="MsoNormal">EXPR='/usr/bin/expr'<o:p></o:p></p>
<p class="MsoNormal">WC='/usr/bin/wc'<o:p></o:p></p>
<p class="MsoNormal">A='/usr/bin/sudo'<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">E_SUCCESS="0"<o:p></o:p></p>
<p class="MsoNormal">E_CRITICAL="2"<o:p></o:p></p>
<p class="MsoNormal">E_UNKNOWN="3"<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">CHAINS=`$A $IPT -nvL | $GREP 'Chain' | $AWK '{ print $2 }'| $GREP Cid | $WC -l`<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">                if [ $CHAINS -ne 0 ] ; then<o:p></o:p></p>
<p class="MsoNormal">                        echo "Firewall is running!"<o:p></o:p></p>
<p class="MsoNormal">                        exit ${E_SUCCESS}<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">                elif [ $CHAINS -eq 0 ] ; then<o:p></o:p></p>
<p class="MsoNormal">                        echo "Firewall is not running"<o:p></o:p></p>
<p class="MsoNormal">                        exit ${E_CRITICAL}<o:p></o:p></p>
<p class="MsoNormal">                fi<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU"><br clear="all">
<o:p></o:p></span></p>
<p><span class="style21"><span lang="EN-GB" style="font-size:9.0pt">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.</span></span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Arial","sans-serif""><br>
<br>
<span class="style21">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></span><span lang="EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU"><br clear="all">
<o:p></o:p></span></p>
<p><span class="style22"><span lang="EN-GB" style="font-size:9.0pt">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.</span></span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Arial","sans-serif""><br>
<br>
<span class="style22">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></span><span lang="EN-GB"><o:p></o:p></span></p>
</div>
</body>
</html>