Nested (on demand)macros

Marc Powell marc at ena.com
Mon Jan 11 14:51:44 CET 2010


On Jan 11, 2010, at 6:03 AM, Simon Kainz wrote:

> Hi list!
> 
> I#M using Nagios 2.9  and have the following question:
> 
> I'm trying to save some typing and to prettyfy my config files, so i
> came up with the following:
> 
> 
> check_command
> check-host-adaptive!$SERVICESTATEID:$HOSTNAME$:conn$!$SERVICEATTEMPT:$HOSTNAME$:conn$
> 

I don't know if this double substitution will work*, but if it has a chance to, you need to use the macro in the command{} definition command_line, not the host{} definition.

See http://nagios.sourceforge.net/docs/3_0/clusters.html for an example.

* I don't believe this is going to work because it's not listed as one of the macros that's expected to contain other macros. From the Macros documenation --

Macro Substitution - How Macros Work

Before Nagios executes a command, it will replace any macros it finds in the command definition with their corresponding values. This macro substitution occurs for all types of commands that Nagios executes - host and service checks, notifications, event handlers, etc.

Certain macros may themselves contain other macros. These include the $HOSTNOTES$, $HOSTNOTESURL$, $HOSTACTIONURL$, $SERVICENOTES$, $SERVICENOTESURL$, and $SERVICEACTIONURL$ macros.


--
Marc
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
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