Page 1 of 1

Getting the right $HOSTGROUPNOTE$ field

Posted: Thu Mar 16, 2017 8:24 am
by mulo
Hi,

We've got an issue and with an issue comes a question :)

The issue which we are facing is that we've created a script which is called from a host escalation, the script takes a number of arguments like $HOSTNAME$ and $HOSTSTATETYPE$ from a nagios command, but we run into a problem when we try to pass the $HOSTGROUPNOTE$ variable to the command. When a host is added to multiple hostgroups or has added mutiple hostgroups to itself, we were unable to specify which hostgroup notes the command should be send to the script, i.e.:

- hostgroup1: notes : testing
- hostgroup2: notes : testtest
- hostgroup3: notes : testing123

The host has been added to all three hostgroups, but we want to pass the notes of hostgroup2 to the command/script.

is there a way that you guys know of that can help me specify which hostgroupnote variable should be passed?

Thnx in advance!

regards,

Kees

Re: Getting the right $HOSTGROUPNOTE$ field

Posted: Thu Mar 16, 2017 12:02 pm
by tmcdonald
Check out the on-demand macros section of the documentation:

https://assets.nagios.com/downloads/nag ... acros.html

You should be able to use $HOSTGROUPNOTE:hostgroup2$ here.