Hi Everyone,
I'm trying to use Custom Variables from my nagios XI GUI but facing below issues
1. I'm using below command arguments, custom variables
$USER1$/check_purefa_alert.py $HOSTADDRESS$ $ARG1$
CUSTOM VARIABLE is _purefa_apitoken
As per the documentation, I'm using _HOST before the variable name while using as arguments, in this case "$_hostpurefa_apitoken$"
but when using the above custom variable, in command line it is being reflected as /usr/local/nagios/libexec/check_purefa_alert.py IP "$_hostpurefa_apitoken$"
but by using like this no output is being showin in Nagios XI command line
2. I have declared Custom Variables under "Manage Custom Variables" in a host, but after saving no matter if I'm saving these using small or cappital letters, it's always showing in small letters only (I don't know whether it is intended functionality or not)
3. After declaring custom variables, I created a new service and entered these custom variables in place of arguments, no output or output as below
PURE_FA_ALERT UNKNOWN - FA REST call returned "PureError: Failed to retrieve session token with error: {"errors":[{"context":"$","message":"Unable to list user for API token."}]} (400)"
4. In the place of arguments I tried all possibilities mentioned below but no use
$_hostpurefa_apitoken$
$_purefa_apitoken$
$_HOSTPUREFA_APITOKEN$
$_PUREFA_APITOKEN$
Could anyone please help me on this. As I'm not able to use custom variable, It's very hectic work to enter everything manually
Thank You
How to use Custom Variables - Tried all possible ways but facing issues
-
DileepKumar
- Posts: 43
- Joined: Thu May 22, 2025 10:43 am
Re: How to use Custom Variables - Tried all possible ways but facing issues
Hello,
When using custom variables your naming convention is correct and should work. When you're in the service or host configuration using the custom variable the correct way to call it is $_HOSTPUREFA_APITOKEN$. Something that is confusing though is that if you try running the check in the Core Config Manager using "Run Check Command" it will not properly interpret your variable. This means after adding your custom variable and putting it into your service or host (and applying the new config) go to the host or service itself and force an immediate check. This should result in a successful check. I would ensure as well that in the service you make that you define what the host is using "Manage Hosts" in the common settings tab. This will ensure that the service inherits the custom variable.
Let me know if you have any more questions or difficulties with this.
- Caleb
When using custom variables your naming convention is correct and should work. When you're in the service or host configuration using the custom variable the correct way to call it is $_HOSTPUREFA_APITOKEN$. Something that is confusing though is that if you try running the check in the Core Config Manager using "Run Check Command" it will not properly interpret your variable. This means after adding your custom variable and putting it into your service or host (and applying the new config) go to the host or service itself and force an immediate check. This should result in a successful check. I would ensure as well that in the service you make that you define what the host is using "Manage Hosts" in the common settings tab. This will ensure that the service inherits the custom variable.
Let me know if you have any more questions or difficulties with this.
- Caleb
-
DileepKumar
- Posts: 43
- Joined: Thu May 22, 2025 10:43 am
Re: How to use Custom Variables - Tried all possible ways but facing issues
Hey @cdepaulis ,
Thank you very much, you have been really helpful for me over the past few days on different topics.
I'm very pleased to inform you that I am able to successfully use the CUSTOM VARIABLES based on your suggestion. I have been facing this issue from few months now but always tried "Run Check Command" under services in CCM and when it failed thought it's not working but today I tried your way and it's working, Thank you very much.
We can mark this as closed if that's possible.
Thank you
Thank you very much, you have been really helpful for me over the past few days on different topics.
I'm very pleased to inform you that I am able to successfully use the CUSTOM VARIABLES based on your suggestion. I have been facing this issue from few months now but always tried "Run Check Command" under services in CCM and when it failed thought it's not working but today I tried your way and it's working, Thank you very much.
We can mark this as closed if that's possible.
Thank you
Re: How to use Custom Variables - Tried all possible ways but facing issues
Regarding the manual entry you mentioned above, I'm facing a similar situation where I need to apply an API token like this to about 100 different hosts.DileepKumar wrote: ↑Wed Nov 12, 2025 11:06 amAs I'm not able to use custom variable, It's very hectic work to enter everything manuallyBeautifulideas.in
Thank You
Does anyone know if Custom Variables (like _purefa_apitoken) work if they are defined inside a Host Template rather than the Host object itself? I want to avoid entering it 100 times, but I want to make sure the $_HOSTPUREFA_APITOKEN$ macro will still correctly inherit the value from the template.
-
DileepKumar
- Posts: 43
- Joined: Thu May 22, 2025 10:43 am
Re: How to use Custom Variables - Tried all possible ways but facing issues
I don't know whether it is completely possible or not but please give a try for USER MACROS option and try if there is a possibility to create oneParminder wrote: ↑Sat Nov 22, 2025 5:24 amRegarding the manual entry you mentioned above, I'm facing a similar situation where I need to apply an API token like this to about 100 different hosts.DileepKumar wrote: ↑Wed Nov 12, 2025 11:06 amAs I'm not able to use custom variable, It's very hectic work to enter everything manuallyBeautifulideas.in
Thank You
Does anyone know if Custom Variables (like _purefa_apitoken) work if they are defined inside a Host Template rather than the Host object itself? I want to avoid entering it 100 times, but I want to make sure the $_HOSTPUREFA_APITOKEN$ macro will still correctly inherit the value from the template.
Re: How to use Custom Variables - Tried all possible ways but facing issues
Hello @Parminder,Parminder wrote: ↑Sat Nov 22, 2025 5:24 amRegarding the manual entry you mentioned above, I'm facing a similar situation where I need to apply an API token like this to about 100 different hosts.DileepKumar wrote: ↑Wed Nov 12, 2025 11:06 amAs I'm not able to use custom variable, It's very hectic work to enter everything manuallyBeautifulideas.in
Thank You
Does anyone know if Custom Variables (like _purefa_apitoken) work if they are defined inside a Host Template rather than the Host object itself? I want to avoid entering it 100 times, but I want to make sure the $_HOSTPUREFA_APITOKEN$ macro will still correctly inherit the value from the template.
User Macros sounds like the best option here as @DileepKumar said. I just went ahead and tested if it would work for NCPA tokens and was able to get successful checks. My recommendation if you haven't already is to read this documentation https://assets.nagios.com/downloads/nag ... I-2024.pdf and then create your own User Macro. These do properly translate if you click "run check command" in the CCM so it should be easy enough to see if its working or not.
If you run into any issues or have anymore questions please let me know.
- Caleb