Pluggin - Exit code always 1
Karl DeBisschop
karl at debisschop.net
Mon Sep 22 12:51:17 CEST 2003
On Mon, 2003-09-22 at 01:01, Mark Snyder wrote:
> Please help with this pluggin. The exit code is always 1 but the error message is correct.
> I have include the test output and relevent parts of the code.
>
>
> Test commands and output
>
> ./check_ssp -w 30 -c 33; echo $?
> OK - E10K Temperature at: 26.1 (Waring:30 Critical:33)
> 1
>
> ./check_ssp -w 20 -c 33; echo $?
> WARNING - E10K Temperature at: 26.1 (Waring:20 Critical:33)
> 1
>
> [./check_ssp -w 20 -c 23; echo $?
> CRITICAL - E10K Temperature at: 26.1 (Waring:20 Critical:23)
> 1
>
> Included as suggested in Nagios plug-in development guidlines
>
> use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
>
>
> Here is the code that determines the exit code
>
> $result = 'OK';
>
> if ($temp > $warning) {
> $result = 'WARNING';
> }
> if ($temp > $critical) {
> $result = 'CRITICAL';
> }
>
> print "$result - E10K Temperature at: $temp (Waring:$warning Critical:$critical)\n";
> exit $ERRORS{$result};
In perl, when the words WARNING and CRITICAL are cast to integers, 1 is
the result.
--
Karl
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
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