O'Reilly logo

Nagios, 2nd Edition by Wolfgang Barth

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

D.3 Macros for User-defined Variables

Starting from Nagios 3.0, you can specify your own macros in host, service, and contact definitions. These macros, called custom macros in Nagios jargon, are treated like normal standard macros, and their names begin with an underscore to make them more easily identifiable:

define host {
   host_name         linux01
   ...
   _NSCLIENT_PORT 12489
   _ASSETID       734287
}
define service {
   host_name           linux01
   service_description HTTP
   ...
   _HTTP_PORT          8080
}
define contact {
   contact_name wob
   ...
   _DEPARTMENT  41ZBV
}

They are addressed with a prefixed object type:

$_HOSTNSCLIENT_PORT$
$_HOSTASSETID$
$_SERVICEHTTP_PORT$
$_CONTACTDEPARTMENT$

The macro again starts with an underscore, but the underscore supplied in the definition is omitted. This ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required