On 2012-11-20 22:28, Zachary McGibbon wrote:
I'm working on some custom event handlers to do traceroutes to hosts when the are down/unreachable (with custom Perl script) and save the data into MYSQL database, however since the traceroute takes a few seconds to run, I notice that Icinga isn't forking the event handler into the background.

same goes for commands and notifications - the core needs to know whether the executed command was successful or not. you should not use eventhandlers taking a long period of time, as they may become blocking when reaching their timeout all the time.


I tested this by applying my event handler to multiple hosts and then setting them all to DOWN/HARD (my script looks for this to run the traceroute) and then as I tail the log file I see it going through the hosts one by one but waiting for the script to finish.

i'd rather put a token for another, cron-triggered script, and return the eventhandler early in that case. like the pnp bulk mode with npcd does - make the traceroute and db inserts asynchronous to the general core check logic.


I tried to add a '&' at the end of my command to see if that could background it but it didn't seem to work:

define command{
        command_name            traceroute-icmp
command_line $USER2$/tracedb.pl <http://tracedb.pl> -4 -i -D $HOSTNAME$ -S $HOSTSTATE$ -T $HOSTSTATETYPE$ -I $HOSTADDRESS$ &
}

Any ideas?
if you really want to put your script into the background, fork a child process and let it go (do not wait for it). though, to note - if this isn't controlled, many eventhandler calls may create multiple children waiting for resources, breaking your system (process monitoring et al).

so, instead of that method, see my asynchronous token proposal above.




Also, any way to increase the 30 second timeout that the event handler has to run with? I can't seem to find a knob anywhere...

http://docs.icinga.org/latest/en/configmain.html#configmain-event_handler_timeout

- Zac


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov


_______________________________________________
icinga-users mailing list
icinga-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/icinga-users


--
DI (FH) Michael Friedrich

mail:     michael.friedr...@gmail.com
twitter:  https://twitter.com/dnsmichi
jabber:   dnsmi...@jabber.ccc.de
irc:      irc.freenode.net/icinga dnsmichi

icinga open source monitoring
position: lead core developer
url:      https://www.icinga.org

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
icinga-users mailing list
icinga-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/icinga-users

Reply via email to