I found the problem. Nagios does not keep nagios user environment (and PATH variable), so it did not find command like "grep" !
I can't believe.... ;-) Regards Marco -}-----Messaggio originale----- -}Da: Masopust, Christian [mailto:[EMAIL PROTECTED] -}Inviato: giovedì 16 marzo 2006 10.58 -}A: Marco Borsani; NAGIOS -}Oggetto: RE: [Nagios-users] Strange situation.. -} -} -}Does your nagios user have read permissions to your Invio_Rice.log? -} -} -} -}> -----Original Message----- -}> From: [EMAIL PROTECTED] -}> [mailto:[EMAIL PROTECTED] On Behalf -}Of Marco -}> Borsani -}> Sent: Thursday, March 16, 2006 10:30 AM -}> To: 'NAGIOS' -}> Subject: [Nagios-users] Strange situation.. -}> Importance: High -}> -}> Hi all! -}> -}> I prepare a very simple check (called check_fax) that read a text -}> file. -}> -}> If check_fax find an "OK" it will return a status 0, if -}check_fax find -}> a "CRITICAL" it will return a status 2. -}> -}> Well, when I run manually check_fax (like nagios user or root -}> user) it work -}> correctly (returns 0), but when Nagios run check_fax, it returns a -}> status 2. -}> -}> I try to modify check_fax permissions like: -}> -rwxr-xr-x 1 root sys 654 Mar 16 09:42 check_fax -}> -rwxr-xr-x 1 nagios nagios 654 Mar 16 09:42 check_fax -}> But nothing has been changed. -}> -}> Here it is the check_fax: -}> -}---------------------------------------------------------------------- -}> #!/bin/csh -}> # -}> set dir2 = /tmp -}> -}> set STATUS = `cat $dir2/Invio_Rice.log | grep -c OK` -}> -}> if ( "$STATUS" == "1" ) then -}> echo "FAX OK - Invio e ricezione di prova avvenuto" > -}> $dir2/Rice.log -}> echo "FAX OK - Invio e ricezione di prova avvenuto" -}> else -}> echo "FAX CRITICAL - Invio e ricezione di prova NON -}avvenuto" -}> > $dir2/Rice.log -}> echo "FAX CRITICAL - Invio e ricezione di prova NON -}avvenuto" -}> exit 2 -}> endif -}> -}> exit 0 -}> -------------------------------------------------------------- -}> ---------- -}> -}> Any idea? -}> Regards -}> -}> Marco Borsani -}> Unix & Monitoring System Administrator Technical Operation -}> Tel. +39 010 4310115 -}> Fax +39 010 4327454 -}> E-mail: [EMAIL PROTECTED] -}> -}> ITnet S.r.l. - Direzione e Coordinamento di WIND Telecomunicazioni -}> S.p.A. -}> Internet Service Provider -}> Sede legale: Via C.G.Viola, 48 - 00148 Roma -}> Dir. Centrale e Amministrativa: Via Pacinotti, 39 -}> 16151 Genova (Italy) -}> -}> http://www.it.net -}> mailto:[EMAIL PROTECTED] -}> _______________________________________________________________ -}> Altre sedi ITnet: -}> MILANO tel.: +39 02 30114900 [EMAIL PROTECTED] -}> ROMA tel.: +39 06 83116707 [EMAIL PROTECTED] -}> _______________________________________________________________ -}> ITnet is associated to CIX (Commercial IP eXchange) and -}RIPE ITnet is -}> associated to AIIP (Associazione Italiana Internet Providers) -}> -}> -}> -}> -}> ------------------------------------------------------- -}> This SF.Net email is sponsored by xPML, a groundbreaking scripting -}> language that extends applications into web and mobile -}media. Attend -}> the live webcast and join the prime developer group -}breaking into this -}> new coding territory! -}> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720& -}> dat=121642 -}> _______________________________________________ -}> Nagios-users mailing list -}> Nagios-users@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 -}> -} ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642 _______________________________________________ Nagios-users mailing list Nagios-users@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