<br><font size=2 face="sans-serif">Hi again,</font>
<br>
<br><font size=2 face="sans-serif">First: I don't know if it is a good
idea to let nagios be "root"...</font>
<br><font size=2 face="sans-serif">Second: What do you think about this
Perl Script? I think this will do what you want. BEWARE this ist NOT testet.</font>
<br>
<br><font size=2 face="sans-serif">#### cut ####</font>
<br><font size=2 face="sans-serif">#!/usr/bin/perl</font>
<br><font size=2 face="sans-serif">#</font>
<br><font size=2 face="sans-serif">#</font>
<br><font size=2 face="sans-serif">##</font>
<br>
<br><font size=2 face="sans-serif"># Check for enough Arguments, such like
the IP Address out of $HOSTADDRESS</font>
<br><font size=2 face="sans-serif">if (!@ARGV[0]){</font>
<br><font size=2 face="sans-serif">        print "\n\tWe
need more arguments!\n\t";</font>
<br><font size=2 face="sans-serif">        exit -1;</font>
<br><font size=2 face="sans-serif">}</font>
<br>
<br><font size=2 face="sans-serif"># Nagios Return Code Definition</font>
<br><font size=2 face="sans-serif">#</font>
<br><font size=2 face="sans-serif">my %ERRORS = ('UNKNOWN', '-1',</font>
<br><font size=2 face="sans-serif">           
    'OK', '0',</font>
<br><font size=2 face="sans-serif">           
    'WARNING', '1',</font>
<br><font size=2 face="sans-serif">           
    'CRITICAL', '2');</font>
<br>
<br>
<br><font size=2 face="sans-serif">system=`/bin/ping -c 2 -w 2 @ARGV[0]
> /path/to/out`;</font>
<br><font size=2 face="sans-serif">open (FILE,"<out");</font>
<br><font size=2 face="sans-serif">while(<FILE>)</font>
<br><font size=2 face="sans-serif">{</font>
<br><font size=2 face="sans-serif"> if ($_ =~ /0 received/)  
       </font>
<br><font size=2 face="sans-serif"> {</font>
<br><font size=2 face="sans-serif"> print ("CRITICAL - Plugin
timed out after 10 seconds\n");</font>
<br><font size=2 face="sans-serif"> exit $ERRORS{CRITICAL}</font>
<br><font size=2 face="sans-serif"> }</font>
<br><font size=2 face="sans-serif"> if ($_=~ /2 received/)  
        </font>
<br><font size=2 face="sans-serif"> {</font>
<br><font size=2 face="sans-serif"> print ("PING -OK\n");</font>
<br><font size=2 face="sans-serif"> exit $ERRORS{OK}</font>
<br><font size=2 face="sans-serif"> }</font>
<br><font size=2 face="sans-serif">### paste ###<br>
</font>
<br><font size=2 face="sans-serif">Hope this will help.</font>
<br><font size=2 face="sans-serif">Hendrik</font>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b><prabhu.anandh@wipro.com></b>
</font>
<br><font size=1 face="sans-serif">Gesendet von: nagios-users-admin@lists.sourceforge.net</font>
<p><font size=1 face="sans-serif">02.03.2004 14:23</font>
<td width=59%>
<table width=100%>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">An</font></div>
<td valign=top><font size=1 face="sans-serif"><h.baecker@ecofis.de>,
<nagios-users@lists.sourceforge.net></font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Kopie</font></div>
<td valign=top>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Thema</font></div>
<td valign=top><font size=1 face="sans-serif">RE: Antwort: RE: [Nagios-users]
script giving plugin missing error.</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=2 color=blue face="Arial">hi hendrik,</font>
<br><font size=2 color=blue face="Arial">I am running in root only.and
for your information if i run that script manually i get the output.the
problem i beleive that i  have is ,if i given the hostaddress in checkcommands.cfg
and i have made no provision for getting this variable in my script maybe
this causes problems.any ideas??????? will it be the problem???but  even
if i type the address manually in the script and then run nagios........it
still doesnt work. i have given the full path for every check_new(shell
script), new.pl and also for out file.</font>
<br><font size=2 color=blue face="Arial">if i run manually the script alone,it
works.strange...........</font>
<br><font size=2 color=blue face="Arial">thanks in advance.</font>
<br><font size=3> </font>
<br><font size=2 face="Arial"><b>regards,</b></font>
<br><font size=2 face="Arial"><b>Prabhu Anandh S.</b></font>
<br><font size=2 face="Tahoma">-----Original Message-----<b><br>
From:</b> nagios-users-admin@lists.sourceforge.net [mailto:nagios-users-admin@lists.sourceforge.net]
<b>On Behalf Of </b>h.baecker@ecofis.de<b><br>
Sent:</b> Tuesday, March 02, 2004 6:33 PM<b><br>
To:</b> Prabhu Anandh (WT01 - TELECOM & INTER-NETWORKING SOLUTIONS);
nagios-users@lists.sourceforge.net<b><br>
Subject:</b> Antwort: RE: [Nagios-users] script giving plugin missing error.<br>
</font>
<br><font size=2 face="sans-serif"><br>
Hi Prabhu,</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
Did you try to execute your script as "nagios-user" or just as
root? Perhaps the nagios user is not permitted to write files in the working
directory of your script?</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
Regards</font><font size=3> </font><font size=2 face="sans-serif"><br>
Hendrik</font><font size=3> <br>
<br>
<br>
<br>
</font>
<table width=100%>
<tr valign=top>
<td width=49%><font size=1 face="sans-serif"><b><prabhu.anandh@wipro.com></b>
<br>
Gesendet von: nagios-users-admin@lists.sourceforge.net</font><font size=3>
</font>
<p><font size=1 face="sans-serif">02.03.2004 13:48</font><font size=3>
</font>
<td width=50%>
<br>
<table width=100%>
<tr>
<td width=12%>
<div align=right><font size=1 face="sans-serif">An</font></div>
<td width=87% valign=top><font size=1 face="sans-serif"><fredrik.wanglund@mobeon.com></font><font size=3>
</font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Kopie</font></div>
<td valign=top><font size=1 face="sans-serif"><nagios-users@lists.sourceforge.net></font><font size=3>
</font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Thema</font></div>
<td valign=top><font size=1 face="sans-serif">RE: [Nagios-users] script
giving plugin missing error.</font></table>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=49%>
<td width=50%></table>
<br></table>
<br><font size=3><br>
<br>
</font><font size=2><tt><br>
Hi fredrik,<br>
I have checked it and the problem is not with the nagios.when it tries
to execute check_new and the shell script does not create the "out
" file.<br>
Any ideas of how to solve the problem.i have given the full path for new.pl
,but it is not working.<br>
If I try to execute manually by changing the $HOSTADDRESS in shell script
with the exact address,it create out file.otherwise not????????why??<br>
Thanks in advance.<br>
<br>
regards,<br>
Prabhu Anandh S.<br>
<br>
<br>
-----Original Message-----<br>
From: Fredrik Wänglund [mailto:fredrik.wanglund@mobeon.com] <br>
Sent: Tuesday, March 02, 2004 5:28 PM<br>
To: Prabhu Anandh (WT01 - TELECOM & INTER-NETWORKING SOLUTIONS)<br>
Cc: nagios-users@lists.sourceforge.net<br>
Subject: Re: [Nagios-users] script giving plugin missing error.<br>
<br>
<br>
The problem is the line './new.pl'<br>
<br>
Nagios is not executed from the libexec-directory, so you need the full
<br>
path to the secondary script (and to the outfile).<br>
<br>
/FredrikW<br>
<br>
<br>
<br>
prabhu.anandh@wipro.com wrote:<br>
<br>
> Hi folks this is what I tried and I get the following error<br>
> (127 out of bounds plugin may be missing.)<---from status.log file<br>
> <br>
> This is the shell script that invokes perl script since I don't know
<br>
> how to check strings in shell script.<br>
> <br>
> #!/bin/sh<br>
> RES1= `/bin/ping -c 2 -w 2 $HOSTADDRESS > out`   <-----------------I
am<br>
> sending only 2 packets.<br>
> RET=$?<br>
> echo $RES1<br>
> ./new.pl<br>
> exit $RET<br>
> <br>
> Perl script reads as follows:<br>
> <br>
> #!/usr/bin/perl<br>
> open (FILE,"<out");<br>
> while(<FILE>)<br>
> {<br>
> if ($_ =~ /0 received/)          <-----------------if
no packets are<br>
> received ,I will give it as critical or warning.<br>
> {<br>
> print ("CRITICAL - Plugin timed out after 10 seconds\n");<br>
> }<br>
> if ($_=~ /2 received/)           <-------------if
both are received ,I<br>
> assume that host is up.<br>
> {<br>
> print ("PING -OK\n");<br>
> }<br>
> }<br>
> #print "$_";<br>
> close (FILE);<br>
> <br>
> <br>
> In hosts.cfg<br>
> I have given check_command as check_new <----name of the shell
file.<br>
> <br>
> In checkcommands.cfg<br>
> Command_line /home/var/check_new $HOSTADDRESS<br>
> <br>
> <br>
> How do I make the following to take effect in the web interface. Or
<br>
> where and what mistake I did.<br>
> <br>
> Thanks in advance.<br>
>   <br>
> Regards,<br>
> Prabhu Anandh<br>
> <br>
> <br>
> -------------------------------------------------------<br>
> SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and
<br>
> deploy apps & Web services for Linux with a free DVD software
kit from <br>
> IBM. Click Now! http://ads.osdn.com/?ad_id56&alloc_id438&op=click<br>
> _______________________________________________<br>
> Nagios-users mailing list<br>
> Nagios-users@lists.sourceforge.net<br>
> https://lists.sourceforge.net/lists/listinfo/nagios-users<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>
<br>
<br>
<br>
-------------------------------------------------------<br>
SF.Net is sponsored by: Speed Start Your Linux Apps Now.<br>
Build and deploy apps & Web services for Linux with<br>
a free DVD software kit from IBM. Click Now!<br>
http://ads.osdn.com/?ad_id56&alloc_id438&opĚk<br>
_______________________________________________<br>
Nagios-users mailing list<br>
Nagios-users@lists.sourceforge.net<br>
https://lists.sourceforge.net/lists/listinfo/nagios-users<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>
<br>
</tt></font><font size=3><br>
</font>
<br>