Yes , Its defined and script running fine when i run it via bash from user nagios .<br><br><br><br><div class="gmail_quote">On Fri, Jul 20, 2012 at 5:47 PM, Assaf Flatto <span dir="ltr"><<a href="mailto:nagios@flatto.net" target="_blank">nagios@flatto.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div bgcolor="#ffffff" text="#000000"><div><div class="h5">
On 20/07/12 12:41, vishesh kumar wrote:
</div></div><blockquote type="cite"><div><div class="h5">Hi Members,<br>
<br>
I wrote below script to monitor ssh traffic <br>
<br>
+++++++++++++++++++++++++++++++++++++++++++<br>
a=$(/usr/bin/sudo /sbin/iptables -vL|/bin/grep ':ssh'|/bin/awk
'{print $1}')<br>
if [ $a -gt 3 ]; then<br>
echo "SSH aatempt is TOO High | $a"<br>
exit 2<br>
else<br>
if [ $a -gt 2 ]; then<br>
echo "SSH aatempt is Average | $a"<br>
exit 1<br>
else<br>
echo "No SSH attempts | $a"<br>
exit 0<br>
fi<br>
fi<br>
exit 3<br>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++<br>
<br>
This script is working fine on shell and returning "SSH attempt is
too high" . But when i run it via nagios the output returned OK
and print "No SSH attempts".<br>
<br>
What I can notice that variable a not holding any value while
running via nagios , while its working fine when running via
shell.<br>
<br>
Can you please drive me in right direction ?<br>
<br>
<br>
Thanks<br>
</div></div><pre><fieldset></fieldset>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. <a href="http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/" target="_blank">http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/</a></pre>
<pre><fieldset></fieldset>
_______________________________________________
Nagios-users mailing list
<a href="mailto:Nagios-users@lists.sourceforge.net" target="_blank">Nagios-users@lists.sourceforge.net</a>
<a href="https://lists.sourceforge.net/lists/listinfo/nagios-users" target="_blank">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>
Is your nagios user defined as allowed to use sudo ?<br>
</div>
<br>------------------------------------------------------------------------------<br>
Live Security Virtual Conference<br>
Exclusive live event will cover all the ways today's security and<br>
threat landscape has changed and how IT managers can respond. Discussions<br>
will include endpoint security, mobile security and the latest in malware<br>
threats. <a href="http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/" target="_blank">http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/</a><br>_______________________________________________<br>
Nagios-users mailing list<br>
<a href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/nagios-users" target="_blank">https://lists.sourceforge.net/lists/listinfo/nagios-users</a><br>
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.<br>
::: Messages without supporting info will risk being sent to /dev/null<br></blockquote></div><br><br clear="all"><br>-- <br><a href="http://linuxmantra.com">http://linuxmantra.com</a><br>