event_handler arguments ($ARG1$)
Anurag Gupta
agupta at yahoo-inc.com
Tue Aug 5 23:50:28 CEST 2003
No, user arguments can not be passed to Nagios event handlers. Look under
the Event Handler columns on this page.
http://nagios.sourceforge.net/docs/1_0/macros.html
hope this helps
-anurag
-----Original Message-----
From: nagios-users-admin at lists.sourceforge.net
[mailto:nagios-users-admin at lists.sourceforge.net]On Behalf Of Justin Matlock
Sent: Tuesday, August 05, 2003 2:29 PM
To: nagios-users at lists.sourceforge.net
Subject: [Nagios-users] event_handler arguments ($ARG1$)
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/4f868e72/attachment.html>
More information about the Users
mailing list