custom plugin problem.
Jeremy Russell
Jeremy.Russell at chickasaw.net
Fri Apr 11 22:35:43 CEST 2003
You might need to specify the absolute path to "grep" or beter yet
specify a PATH in the beginning of the startup script for nagios.
Jeremy Russell
Network Administrator, CNI
580-272-2707
-----Original Message-----
From: Jeff McKeon [mailto:jsm at inpro.net]
Sent: Friday, April 11, 2003 3:24 PM
To: Nagios List
Subject: [Nagios-users] custom plugin problem.
hello all,
I've got 5 UPS's all connected to my Nagios server via an 8 port serial
card. Currently I have 5 check_ups services running to check all the
ups's That's fine but I was thinking if I got it down to one pluggin
that could check all 5 at once, it would cut down on the services
overhead.
so I wrote this script... "check_all_ups1" (no laughing at my scripting
ability, I never claimed to be a programmer :oP )
****************************************
#! /bin/sh
UPS01=`/usr/local/nagios/libexec/check_ups -H localhost -u ups0-1 -v
BATTPCT -w 99 -c 98`
UPS11=`/usr/local/nagios/libexec/check_ups -H localhost -u ups1-1 -v
BATTPCT -w 99 -c 98`
UPS12=`/usr/local/nagios/libexec/check_ups -H localhost -u ups1-2 -v
BATTPCT -w 99 -c 98`
UPS21=`/usr/local/nagios/libexec/check_ups -H localhost -u ups2-1 -v
BATTPCT -w 99 -c 98`
UPS22=`/usr/local/nagios/libexec/check_ups -H localhost -u ups2-2 -v
BATTPCT -w 99 -c 98`
echo "UPS0-1 $UPS01" > ups.status
echo "UPS1-1 $UPS11" >> ups.status
echo "UPS1-2 $UPS12" >> ups.status
echo "UPS2-1 $UPS21" >> ups.status
echo "UPS2-2 $UPS22" >> ups.status
numbad=`grep -c problem ups.status`
badups=`grep problem ups.status`
if [ $numbad -ge 1 ]; then
echo "CRITICAL: $numbad CK UPS's have switched to battery power"
exit 1;
fi
echo "OK: All UPS's on-line"
exit 0;
*************************************
If I run it from the command line it works great. If I run it in nagios
though, it only ever returns a status of OK, even when the normal
check_ups pluggin is showing critical.
What did I screw up here or is it just not possible to use a script as a
pluggin?
thanks,
jeff
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The
debugger
for complex code. Debugging C/C++ programs can leave you feeling lost
and
disoriented. TotalView can help you find your way. Available on major
UNIX
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
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
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger
for complex code. Debugging C/C++ programs can leave you feeling lost and
disoriented. TotalView can help you find your way. Available on major UNIX
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
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