eventhandler halts Nagios

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
uplink
Posts: 3
Joined: Mon Nov 12, 2012 10:01 am

eventhandler halts Nagios

Post by uplink »

In my central Nagios installation, I make use of ConSol*'s check_logfiles script. In some situations, I need to pause regular checking, manually run some cruncher on a remote machine, then restart checking that service.

This is done as event handler, which works well.

However it seems the whole of Nagios (checks, updates to nagios.log, everything) pauses, every time said eventhandler script is run.

I care, because this processing done in an eventhandler can take tens of minutes, during which nothing else happens at the central Nagios site, as well as a check for Nagios' wellbeing triggers, as nagios.log is not updated.

Before I dig deeper .. is this by design?
Am I calling my script wrong?
Should I take care of going into the background myself?

Code: Select all

define command {
        command_name    untangle-check_logfiles-over-ssh
        command_line    $USER2$/untangle-check_logfiles-over-ssh $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ $HOSTADDRESS$ $ARG1$ '$ARG2$'
}

define service {
...
    eventhandler    untangle-check_logfiles-over-ssh!username!'check_logfiles -f check_logfiles.conf --searches=Service.Log'
}
Any help is greatly appreciated!

Rupert
Last edited by uplink on Mon Dec 10, 2012 12:21 pm, edited 1 time in total.
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: eventhandler halts Nagios

Post by mguthrie »

Event handlers are blocking processes in Nagios, which means all checks, alerts, and otherwise will wait for that event handler to complete execution. So whatever the event handler is, you want it to be very quick to complete execution. What might be better would be to have the event handler either touch a file, or create a job in a database, and then have a cron job or something run the actual process.
uplink
Posts: 3
Joined: Mon Nov 12, 2012 10:01 am

Re: eventhandler halts Nagios

Post by uplink »

mguthrie wrote:Event handlers are blocking processes in Nagios
that's what I feared. ok, will come up with a nonblocking/external solution.

thanks!
uplink
Posts: 3
Joined: Mon Nov 12, 2012 10:01 am

Re: eventhandler halts Nagios

Post by uplink »

uplink wrote:will come up with a nonblocking/external solution.
for others' reference: changed my calling some eventhandler to use at .. presto:

Code: Select all

define command {
        command_name    untangle-check_logfiles-over-ssh
        command_line    echo "$USER2$/untangle-check_logfiles-over-ssh $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ $HOSTADDRESS$ $ARG1$ '$ARG2$'" | /usr/bin/at now
}
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: eventhandler halts Nagios

Post by mguthrie »

That actually simplifies something I was trying to get to work a while back, thanks for posting what you did!
Locked