Nagios XI Macros not populating

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Post Reply
chris_hird
Posts: 22
Joined: Mon Jan 18, 2021 8:47 am

Nagios XI Macros not populating

Post 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...
kg2857
Posts: 499
Joined: Wed Apr 12, 2023 5:48 pm

Re: Nagios XI Macros not populating

Post by kg2857 »

Where are you defining this in nagios:
/[path]/test.php?host=$HOSTNAME$&check=$SERVICECHECKCOMMAND$
chris_hird
Posts: 22
Joined: Mon Jan 18, 2021 8:47 am

Re: Nagios XI Macros not populating

Post 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
-SN
Posts: 10
Joined: Wed Feb 25, 2026 12:39 pm

Re: Nagios XI Macros not populating

Post by -SN »

Make sure you have enabled this User Macro before trying to use it ;)
UserMacro.PNG
You do not have the required permissions to view the files attached to this post.
-SN
Posts: 10
Joined: Wed Feb 25, 2026 12:39 pm

Re: Nagios XI Macros not populating

Post 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
You do not have the required permissions to view the files attached to this post.
Post Reply