Using NRPE to call remote event_handlers
Mark Pearson
Mark.Pearson at uftwf.org
Sat Dec 3 16:03:58 CET 2005
Oh and yes I did configure nrpe with the enable commands. In fact, I use
args with nrpe on plugins but this problem is with the event handlers.
Here is a copy of my event handler: But like I mentioned before, this
script works running locally but via check_nrpe from the central monitoring
machine it doesn't work.
#!/bin/sh
#
# Event handler script for restarting the web server on the local machine
#
# Note: This script will only restart the web server if the service is
# retried 3 times (in a "soft" state) or if the web service somehow
# manages to fall into a "hard" error state.
#
set -x
# What state is the HTTP service in?
case "$1" in
OK)
;;
WARNING)
;;
UNKNOWN)
;;
CRITICAL)
# Is this a "soft" or a "hard" state?
case "$2" in
SOFT)
case "$3" in
2)
echo -n "Restarting Krang service (2rd soft critical
state)..."
sudo /etc/rc.d/init.d/krang restart
;;
esac
;;
HARD)
echo -n "This server would be failing over to the other node
right now" | /usr/bin/logger -t $TAG
# echo -n "Failing over to backup node ..."
# sudo /usr/lib/heartbeat/hb_standby
;;
esac
;;
esac
exit 0
_____
From: Mark Pearson [mailto:Mark.Pearson at uftwf.org]
Sent: Saturday, December 03, 2005 9:46 AM
To: 'Nagios Users Mailing List'
Subject: RE: [Nagios-users] Using NRPE to call remote event_handlers
I am using a sudo in the script as I can run the script that is in the
nrpe.cfg on the machine in question however, when I try to run it via the
check_nrpe command the remote script does not seem to run.
1) How does everyone else restart services on remotely monitored
computers? i.e. the Nagios monitor is running on a computer in NY and the
remote computer is in CA. If the httpd service stops how would you use
nagios to restart the service?
2) Is there a way I can debug the remote client to see where the
problem is?
Thanks for the reply.
_____
From: moshe sharon [mailto:moshesharon at gmail.com]
Sent: Tuesday, November 22, 2005 1:44 AM
To: Nagios Users Mailing List
Subject: Re: [Nagios-users] Using NRPE to call remote event_handlers
Hello
First nrpe only returns one line from output so if your restarting procedure
returns multiple lines you wont see all the lines from the check_nrpe.
second i see you are passing arguments with -a did you enable nrpe with
command arguments ?
and final you can call sudo before your script "/usr/bin/sudo
/usr/local/nagios/libexec/check_disk ..." other then that seems you doing it
perfectly fine
Moshe Sharon
****************************************************************************
***
The views, opinions, and judgments expressed in this message are solely
those of the author. The message contents have not been reviewed or approved
by the UFT Welfare Fund.
****************************************************************************
***
*******************************************************************************
The views, opinions, and judgments expressed in this message are solely those of the author. The message contents have not been reviewed or approved by the UFT Welfare Fund.
*******************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20051203/8070c3fe/attachment.html>
More information about the Users
mailing list