<br><font size=2 face="sans-serif">Hi Nagiosexchange users!!!</font>
<br>
<br><font size=2 face="sans-serif">I have some problems with this  bash
script. The objetive is to monitor all the incorrect logins to the sistem
so I created this script.</font>
<br>
<br>
<br><font size=2 face="sans-serif">check_acces </font>
<br><font size=2 face="sans-serif">-----------------------</font>
<br><font size=2 face="sans-serif">#!/bin/bash</font>
<br>
<br><font size=2 face="sans-serif">di=`date '+%B %d'`</font>
<br><font size=2 face="sans-serif">for i in `cut -f1 -d: /etc/passwd`;</font>
<br><font size=2 face="sans-serif">do</font>
<br><font size=2 face="sans-serif">kkY=`grep  \Failed\ \keyboard-interactive/pam\
\for\ \$i /var/log/messages |cut -c1-15|awk "/$di/"`</font>
<br><font size=2 face="sans-serif">if [ "$kkY" != ""
]</font>
<br><font size=2 face="sans-serif">then</font>
<br><font size=2 face="sans-serif">sa1="$sa1 User: $i Date of Attempts:$kkY"</font>
<br><font size=2 face="sans-serif">fi</font>
<br><font size=2 face="sans-serif">done</font>
<br>
<br><font size=2 face="sans-serif">kk6=`grep  \Failed\ \keyboard-interactive/pam\
\for\ \illegal\ \user /var/log/messages |cut -c1-15 |awk "/$di/"`</font>
<br>
<br><font size=2 face="sans-serif">sal2="EXISTING USERS:$sa1 NO EXISTING
USERS: Date of Attempts:$kk6"</font>
<br>
<br><font size=2 face="sans-serif">sal3=`echo $sal2`</font>
<br><font size=2 face="sans-serif">echo $sal3</font>
<br>
<br>
<br><font size=2 face="sans-serif">The script works fine on shell, I execute
the script  like this   ./check_acces and it returns this </font>
<br>
<br>
<br><font size=2 face="sans-serif">EXISTING USERS: User: root Date of Attempts:May
31 08:40:03 May 31 08:40:04 May 31 08:40:15 May 31 08:40:17 May 31 08:40:18
User: jon Date of Attempts:May 31 08:40:33 May 31 08:40:34 May 31 08:40:35
May 31 08:40:36 May 31 08:40:38 NO EXISTING USERS: Date of Attempts:May
31 08:40:54 May 31 08:40:56 May 31 08:40:57 May 31 08:40:59 May 31 08:41:01
May 31 08:41:02 May 31 08:41:04 May 31 08:41:14 May 31 08:41:15 May 31
08:41:16 May 31 08:41:17 May 31 08:41:19 May 31 08:41:20 May 31 08:41:23</font>
<br>
<br><font size=2 face="sans-serif">this is ok, it works fine.</font>
<br>
<br><font size=2 face="sans-serif"> But when I declare a service and
a command on Nagios with this script something extrange happends, only
appears this on Nagios, where are the incorect logins? They doesn´t appear.
</font>
<br>
<table width=100%>
<tr>
<td width=11%>
<div align=center><a href="http://vctsnag/nagios/cgi-bin/status.cgi?hostgroup=test&style=detail&sorttype=1&sortoption=1"></a><a href="http://vctsnag/nagios/cgi-bin/status.cgi?hostgroup=test&style=detail&sorttype=2&sortoption=1"></a></div>
<td width=13%>
<div align=center><font size=3><b> </b></font><a href="http://vctsnag/nagios/cgi-bin/status.cgi?hostgroup=test&style=detail&sorttype=1&sortoption=2"></a><a href="http://vctsnag/nagios/cgi-bin/status.cgi?hostgroup=test&style=detail&sorttype=2&sortoption=2"></a></div>
<td width=13%>
<div align=center><font size=3><b> </b></font><a href="http://vctsnag/nagios/cgi-bin/status.cgi?hostgroup=test&style=detail&sorttype=1&sortoption=3"></a><a href="http://vctsnag/nagios/cgi-bin/status.cgi?hostgroup=test&style=detail&sorttype=2&sortoption=3"></a></div>
<td width=17%>
<div align=center><font size=3><b> </b></font><a href="http://vctsnag/nagios/cgi-bin/status.cgi?hostgroup=test&style=detail&sorttype=1&sortoption=4"></a><a href="http://vctsnag/nagios/cgi-bin/status.cgi?hostgroup=test&style=detail&sorttype=2&sortoption=4"></a></div>
<td width=14%>
<div align=center><font size=3><b> </b></font><a href="http://vctsnag/nagios/cgi-bin/status.cgi?hostgroup=test&style=detail&sorttype=1&sortoption=6"></a><a href="http://vctsnag/nagios/cgi-bin/status.cgi?hostgroup=test&style=detail&sorttype=2&sortoption=6"></a></div>
<td width=14%>
<div align=center><a href="http://vctsnag/nagios/cgi-bin/status.cgi?hostgroup=test&style=detail&sorttype=1&sortoption=5"></a><a href="http://vctsnag/nagios/cgi-bin/status.cgi?hostgroup=test&style=detail&sorttype=2&sortoption=5"></a></div>
<td width=14%>
<div align=center></div></table>
<br><font size=2 face="sans-serif">Service        
                     Status
          Last Check        
             Duration    
            Attempt      
             Status information  
               </font>
<br>
<table width=100%>
<tr>
<td width=16%><font size=2>   </font>
<table width=100%>
<tr>
<td width=87%><font size=2>Incorrect Access </font>
<table width=100%>
<tr>
<td width=100%><a href="http://vctsnag/nagios/cgi-bin/extinfo.cgi?type=2&host=localhost&service=Accesos+incorrectos"></a></table>
<br>
<td width=12%>
<br><font size=2><br>
</font>
<div align=right>
<table width=100%>
<tr>
<td width=100%></table></div>
<br></table>
<br>
<td width=3%><font size=3>OK</font>
<td width=16%><font size=3>05-31-2007 09:30:46</font>
<td width=12%><font size=3>2d 23h 30m 55s</font>
<td width=2%><font size=3>1/4</font>
<td width=48%><font size=3>EXISTING USERS: NO EXISTING USERS: Date of Attempts: </font></table>
<br>
<br><font size=2 face="sans-serif">I dont know why when the script is executed
by nagios it doesn´t return anything and it works fine on shell. The script
 executed by nagios it doesn´t return the same as when you executed
on shell. </font>
<br>
<br><font size=2 face="sans-serif">Someone knows something about this?
 Thank you for help!!!</font>
<br>
<br>
<br><font size=2 face="sans-serif">Aritz.</font>