Page 1 of 1

Nagios XI Macros not populating

Posted: Thu Mar 05, 2026 1:42 pm
by chris_hird
Hi All,
I am currently attempting to use the $SERVICECHECKCOMMAND$ macro.
When adding this to the input I am also using $HOSTNAME$ which is being filled in correctly, however, SERVICECHECKCOMMAND will not fill in?

Example of action url I am using:
/[path]/test.php?host=$HOSTNAME$&check=$SERVICECHECKCOMMAND$

Output:
/[path]/test.php?host=MyHost1&check=$SERVICECHECKCOMMAND$

I have activated the macro in the config...
and this is a supported system macro:
https://assets.nagios.com/downloads/nag ... olist.html

I have also tested using this macro in service arguments and other locations ... all no change...

Any help much appreciated!

Chris...

Re: Nagios XI Macros not populating

Posted: Fri Mar 06, 2026 1:53 am
by kg2857
Where are you defining this in nagios:
/[path]/test.php?host=$HOSTNAME$&check=$SERVICECHECKCOMMAND$

Re: Nagios XI Macros not populating

Posted: Fri Mar 06, 2026 11:18 am
by chris_hird
I am using that as the Notes URL.

But i have attempted to use the macro in every other point like args, notes, action url ... etc ... all no change.

Thanks

Re: Nagios XI Macros not populating

Posted: Sat Mar 07, 2026 1:06 pm
by -SN
Make sure you have enabled this User Macro before trying to use it ;)
UserMacro.PNG

Re: Nagios XI Macros not populating

Posted: Sat Mar 07, 2026 4:20 pm
by -SN
Sorry read that again and you're running into the constraints of what macros work where.

Yes, system macros are available in commands but, what macro in what context is really important
https://assets.nagios.com/downloads/nag ... olist.html

User macros are available in as in system commands and arguments
You can't populate a user macro value with a system macro

As the Nagios docs show, Macros are not available for every field

I have two user macros defined
user-macros.PNG
$USER100$
NOTE: For macro values contain more than one word, the string must be encapsulated in double quotes "Two words".

I have configured two services
Service-B
svc-b-config.PNG
Service-C
svc-c-config.PNG
Also has the notes field populated with $USER100$

In the UI you'll notice what fields are passed.
UI Service-B
Macro-SvcB.PNG
The hostname is not translated and, the raw value is passed.

UI Service-C
Macro-SvcC.PNG
Notes is not and interpreted field.

Now, if I were to chain a handler to the service, I would be able to pass $SERVICECHECKCOMMAND$, $SERVICEDESC$ to that command as defined in Nagios and have them be populated with the data.

Why? The Service/Host check has been executed so the value that populates that macro is now defined.

Code: Select all

waketheded.py --who='really.important.com' --state=1 --state_type=1 --command='$SERVICECHECKCOMMAND$' --service="$SERVICEDESC" notes="$SERVICENOTES$"


Hope this helps.
Happy Monitoring!
--SN