How to access user-defined service variables in a command object

Paul M. Dubuc work at paul.dubuc.org
Mon Feb 8 19:59:29 CET 2010


I'm trying to integrate the use of an internally developed alarm 
generation command into our Nagios configuration.  So I want to define 
an Nagios command object that calls this command with arguments specific 
to the service that is generating the status condition that generates 
the alarm.  One of the arguments is an alarm number.  I can set this 
number in the service definition as a user defined variable:

define service{
    ...
    __ALARM_NUMBER   123
}

Is it possible to access this variable in the command definition using 
on-demand macros?  I tried to do this in the following way, but it 
doesn't seem to work:

define command{
    command_name    notify-service-by-alarm
    command_line    /usr/local/bin/sendalarm $HOSTALIAS$ 
$_SERVICE_ALARM_NUMBER:HOSTNAME:SERVICEDESC$ $SERVICESTATE$ 
$SERVICEDESC$ $SERVICEOUTPUT$
}

Is there an alternative?

Thanks,

Paul M. Dubuc

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
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