plugins always OK with nrpe

Andreas Ericsson ae at op5.se
Fri May 13 18:16:58 CEST 2005


Lewis Getschel wrote:
> You want to exit with an 'error level' number (0-3) not the words.
> something like:
> echo "CRITICAL - my problem was bla-bla"
> exit 2
> 

As he properly sources in utils.sh and sets exitstatus to 
$STATE_CRITICAL, it should work regardless.

More below.

> bmathieu wrote:
> 
>> hi
>> i write a plugins which is very simple
>>
>>
>> #!/bin/bash
>>
>> . utils.sh
>>
>> echo "toto"
>> exitstatus="$STATE_CRITICAL"
>> exit $exitstatus
>>
>> and when i call it with check_nrpe it return on nagios server an OK
>> state
>> i don t understand why.

You probably need to give the exact path to utils.sh since nrpe doesn't 
chdir() to the plugins directory. You won't get an indication that the 
sourcing failed from NRPE since it doesn't read stderr.

That said, you should probably also write a test-script like this, to 
simplify debugging

---%<---%<---%<---
#!/bin/sh
. utils.sh
# STATE_CRITICAL is not a string, so assign it as int
status=$STATE_CRITICAL

echo "returning statuscode: $status"
exit $status
---%<---%<---%<---

That way you would have caught that STATE_CRITICAL isn't set properly 
(after triple-checking your spelling, anyway) and thus would have found 
that you need to give the exact path to utils.sh


>> with standard plugins i have no problem
>> i use nrpe-2.0 , nagios-2.0b
>> this check is performed by a distributed server wich send result to 
>> the central server with nsca
>> thanks
>> basile
>>
>>
>>
>>
>>
>>
>>  
>>
> 

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Lead Developer


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at 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





More information about the Users mailing list