Using NRPE to call remote event_handlers

Mark Pearson Mark.Pearson at uftwf.org
Mon Dec 5 21:32:37 CET 2005


The problem is fixed now, even though I don't understand why completely.

To answer the question below, I was using sudo for the command in the
/etc/init.d and the script would work, when executed on the remote machine
when I was logged in as the nagios user.

The problem was executing the event handler using the check_nrpe command.  

To fix the problem I changed service restart part of the event handler
script from:
sudo /etc/rc.d/init.d/krang restart

to:
sudo /etc/rc.d/init.d/krang restart > /dev/null

This is purely my opinion now, but I think that because the "krang restart"
returns multiple lines of output that something goes wrong and the event
handler script is killed by the check_nrpe script.  Thus by sending the
output to "Null" the "krang restart" script can finish while the check_nrpe
script completes.  At least that is my opinion.

Now I can change my other scripts.

Next, doing the same with HeartBeat and failing clusters over.  Oh Joy!  :-0

Thanks everyone!!!
-Mark


-----Original Message-----
From: Tedman Eng [mailto:teng at dataway.com] 
Sent: Monday, December 05, 2005 3:04 PM
To: 'Mark Pearson'
Cc: 'nagios-users at lists.sourceforge.net'
Subject: RE: [Nagios-users] Using NRPE to call remote event_handlers

What user are you testing the event handler as?  Most scripts in /etc/init.d
require root persmission to restart (or some component of the script may).
On the remote box, su to the user that the nrpe daemon executes as, then
test the event handler and let us know what happens.


-----Original Message-----
From: Mark Pearson [mailto:Mark.Pearson at uftwf.org]
Sent: Monday, December 05, 2005 8:55 AM
To: 'Jason Martin'; 'nagios-users at lists.sourceforge.net'
Subject: RE: [Nagios-users] Using NRPE to call remote event_handlers


Thanks Jason.  This is precisely what I am doing but for some reason when I
execute the check_nrpe script on the main Nagios system it does not execute
the corresponding script on the remote box.

Understanding that the check_nrpe script accepts one line of output from the
script that is executed on the remote system, that one line I receive is
part of the normal output of the script running on the remote.  Thus telling
me that the script is running yet the service is not restarting.

Just curious though, when it comes to using nagios' event_handlers to say,
restart httpd, I noticed in the sample cfgs that the event_handlers seem all
to be running locally.  Should I have the full blown nagios running on
remote machine?  Currently, I only have the nrpe, plugins and my
event_handlers I created.

Sorry for all the noobie questions, but this is just not making logical
sense.

Thanks everyone for your help.
-Mark

-----Original Message-----
From: Jason Martin [mailto:jhmartin at toger.us] 
Sent: Sunday, December 04, 2005 9:34 PM
To: nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-users] Using NRPE to call remote event_handlers

On Sat, Dec 03, 2005 at 09:20:44PM +0100, Hugo van der Kooij wrote:
> > incorrectly.  I have access to all my systems, however I would like
nagios
> > to automatically attempt to restart a service in the event it stops.
> > What do you do if a service stops?
Write a script for NRPE that performs the restart and invoke it
as a event handler. You may have to use passwordless SUDO to
give it the correct permissions. I suggest thinking about using
tcp wrappers or iptables, as anyone with a NRPE client could
invoke the restart script.

-Jason MArtin
> Write a monitor script and put it in a crontab entry. Run it say every 15
> minutes
> 
> Hugo.
> 

-- 
Never draw fire, it irritates everyone around you
This message is PGP/MIME signed.

****************************************************************************
***
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.
****************************************************************************
***


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
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

*******************************************************************************
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.
*******************************************************************************


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
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