event_handler arguments ($ARG1$)

Justin Matlock jmat at shutdown.net
Tue Aug 5 23:28:45 CEST 2003


Regarding Nagios 1.1:

I've tried a number of things, but it appears that event_handler's can't use user supplied arguments.  I'm trying to use a generic event_handler script to switch dynamic DNS entries around (so if something goes terribly wrong on a website, it switches DNS to point to a "sorry, we're down" web page hosted elsewhere). 

The only way I can make it work is to make individual event_handlers for each service... which is really a pain in the butt. 

Do event_handlers not support ARG1, ARG2, etc?

Here's my event handler itself:

define command {
        command_name    switch_dns
        command_line    /usr/local/nagios/libexec/eventhandlers/switch_dns $SERVICESTATE$ $STATETYPE$ $SERVICEATTEMPTS$ $ARG1$ $ARG2$ $ARG3$
}

My shell script just takes the hostname ($4), and changes the IP to $5 if the SERVICESTATE is OK, and to $6 if it's CRITICAL.  

Then the service that points to it:

define service {
        ; lots of stuff removed for readability
       event_handler                   switch_dns!website.com!111.111.111.111!222.222.222.222
}

Nagios chokes when I do a verify:

Checking services...
Error: Event handler command 'switch_dns!website.com!111.111.111.111!222.222.222.222' specified in service 'image server' for host 'imgserv' not defined anywhere

Any ideas, or am I going to have to define individual event_handlers?

Thanks;
Justin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20030805/d59bd1f5/attachment.html>


More information about the Users mailing list