return codes and output from check scripts

Brian Wilson wilson at unity.ncsu.edu
Thu Dec 5 20:51:35 CET 2002


On Thu, 5 Dec 2002, Brian Wilson wrote:

>
> I've written a few check scripts to do various things.. and I was under
> the impression that they were working correctly.. but they arent.  Here's
> what happens:
>
> Here's the command defined:
>
> define command{
>         command_name    check_powersupply
>         command_line    $USER1$/check_powersupply $HOSTADDRESS$
>         }
>
> Here's the output of the command from the logs:
>
> [1039116104]
> SERVICE;itspare-6509-1;powersupply;CRITICAL;3/3;HARD;1039116079;1039116139;ACTIVE;1;1;1;1039110049;0;CRITICAL;5347;0;0;2983;1039110049;1;1;0;0;0;0;0.00;0;1;0;1;(No output!)
>
> Here's when i run the command as user nagios from the command line:
> $ ./check_powersupply itspare-6509-1
> SNMP OK - Chassis Power Supplies OK
> $ echo $?
> 0
>
> So why is nagios saying "no output"?  Any ideas?


Oh yeah, and my script does this:

use utils qw(%ERRORS);
if ($ps1status == 2 && $ps2status == 2 ) {
        print "SNMP OK - Chassis Power Supplies OK\n";
        exit $ERRORS{'OK'};
} else {
        print "SNMP CRITICAL - Chassis Power Supply Failure\n";
        exit $ERRORS{'CRITICAL'};
}


Brian

--
Brian Wilson  <wilson at ncsu.edu>      Network Analyst
Communication Technologies, ATD      W: 919.513.3472
North Carolina State University      www.ncstate.net


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf




More information about the Users mailing list