[Nagiosplug-help] Newbie gets no status information
Andreas Ericsson
ae at op5.se
Wed Oct 31 11:16:30 CET 2007
Colin McKinnon wrote:
> Hi all,
>
> I'm a Nagios newbie, but like to think I know what I'm doing with computers.
>
> I've written a couple of plugins using PHP. These seem to be reporting
> the status correctly in Nagios (v. 2.9) but the 'information text' is
> not showing in the frontend.
>
> e.g. when I run my script from the command line:
>
> $ ./check_portal_response.php -p LP -m response -t 10 -w 4 -c 2
> RESPONSE OK : Last ws1 response=0.786052;Last ws2 response=0.687574
> $
>
What does it say if you try
$ ./check_portal_response.php -p LP -m response -t 10 -w 4 -c 2 2>/dev/null | \
sed 1q
?
Basically, that should show you what Nagios will display, assuming you're running
it as the Nagios user, and from the directory that Nagios runs it from.
> But in the web frontend the 'Status information' column is blank.
>
> I've tried:
>
> MEASURE STATUS - INFO
> MEASURE STATUS: INFO
> MEASURE STATUS : INFO
>
What gave you the notion that Nagios cares about the format of your output?
Or rather, where did you try that?
> but none seem to work.
>
I'm not surprised. Nagios doesn't care about the text you print out. It only
cares about the return code of your plugin.
> I've also tried to google 'nagios plugin "status information"' but
> found nothing relevant.
>
Have you checked the nagiosplug documentation? The interface is
> I have confirmed that my script is writing to STDOUT.
>
Sweet. Then you can skip the first step above that I wanted you to try and
focus on finding the error-paths that make your plugin crash before it writes
anything at all to stdout.
> Any ideas?
>
add
echo "Oy daddy! I'm alive\n";
to the top of your script. If that output shows in Nagios, something is wrong
in your plugin (most likely because it can't access one resource or another
that you, as a console user, can).
If it *doesn't* show, I'd suspect permission errors that cause PHP to bomb
out early and print an error message to stderr.
--
Andreas Ericsson andreas.ericsson at op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
More information about the Help
mailing list