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...
Nagios XI Macros not populating
Re: Nagios XI Macros not populating
Where are you defining this in nagios:
/[path]/test.php?host=$HOSTNAME$&check=$SERVICECHECKCOMMAND$
/[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
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
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
Make sure you have enabled this User Macro before trying to use it
You do not have the required permissions to view the files attached to this post.
Re: Nagios XI Macros not populating
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 $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 Service-C Also has the notes field populated with $USER100$
In the UI you'll notice what fields are passed.
UI Service-B The hostname is not translated and, the raw value is passed.
UI Service-C 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.
Hope this helps.
Happy Monitoring!
--SN
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 $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 Service-C Also has the notes field populated with $USER100$
In the UI you'll notice what fields are passed.
UI Service-B The hostname is not translated and, the raw value is passed.
UI Service-C 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.