Hi,
I'm trying to use macro/variable to sets some urls/fqdn to check.
I am using the variable name : FQDN_Product_Service with a value of "devapi.example.org"
And the check command check_http : Check_API_Health!$_HOSTFQDN_PRO_SVC$!http://$_HOSTFQDN_PRO_SVC$/api/Health
When I do a network capture to see what is requested, I see that http://$/api/Health is requested.
Is there some limitation to the length or character choices in the variables? I already discovered that Nagios don't want hyphen '-' within variable names.
Custom Macro/Variable Limitation
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Custom Macro/Variable Limitation
Custom variables should start with an underscore
Code: Select all
_FQDN_Product_Service devapi.example.org-
avezinaATetl
- Posts: 7
- Joined: Mon Nov 26, 2018 11:46 am
Re: Custom Macro/Variable Limitation
Hi Scott, thank you for your reply.
Yes, custom variable starts with an underscore. I forgot about it in my post, but I do have them in my configs.
While I do some more test to expand my question, can you answer this question : Is there a character limitation (hyphens, underscore, other symbols) or limit for custom variables?
Yes, custom variable starts with an underscore. I forgot about it in my post, but I do have them in my configs.
While I do some more test to expand my question, can you answer this question : Is there a character limitation (hyphens, underscore, other symbols) or limit for custom variables?
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Custom Macro/Variable Limitation
Not specifically, other that what is posted here
https://assets.nagios.com/downloads/nag ... tvars.html
However I just realized you are adding them in the $ARGn$ fields, and honestly, I don't think that will work
You will likely need to make a new command definition and pass the $_HOSTFQDN_PRO_SVC$ variable where you have $ARG1$, etc.
ALSO, I just saw this
you said the variables are named
but you are referencing
instead of
https://assets.nagios.com/downloads/nag ... tvars.html
However I just realized you are adding them in the $ARGn$ fields, and honestly, I don't think that will work
You will likely need to make a new command definition and pass the $_HOSTFQDN_PRO_SVC$ variable where you have $ARG1$, etc.
ALSO, I just saw this
you said the variables are named
Code: Select all
_FQDN_Product_ServiceCode: Select all
$_HOSTFQDN_PRO_SVC$Code: Select all
$_HOSTFQDN_PRODUCT_SERVICE$-
avezinaATetl
- Posts: 7
- Joined: Mon Nov 26, 2018 11:46 am
Re: Custom Macro/Variable Limitation
Thank you again.
The variables are not the same in my initial post because I used placeholders and didn't use them the same way for the post.
After checking everything again, I had some typo at multiple places. Fixed them.
I think my problem was caused by not using all upercase in my variables names and places where I use them.
Here is my check_command that works:
$USER1$/check_http -I $HOSTADDRESS$ -e '200 OK' -H $_HOSTFQDN_ENROUTE-ROUTE$ -u https://$_HOSTFQDN_ENROUTE-ROUTE$/api/Health -S
The variables are not the same in my initial post because I used placeholders and didn't use them the same way for the post.
After checking everything again, I had some typo at multiple places. Fixed them.
I think my problem was caused by not using all upercase in my variables names and places where I use them.
Here is my check_command that works:
$USER1$/check_http -I $HOSTADDRESS$ -e '200 OK' -H $_HOSTFQDN_ENROUTE-ROUTE$ -u https://$_HOSTFQDN_ENROUTE-ROUTE$/api/Health -S
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Custom Macro/Variable Limitation
Great! May we mark this resolved?avezinaATetl wrote:Thank you again.
The variables are not the same in my initial post because I used placeholders and didn't use them the same way for the post.
After checking everything again, I had some typo at multiple places. Fixed them.
I think my problem was caused by not using all upercase in my variables names and places where I use them.
Here is my check_command that works:
$USER1$/check_http -I $HOSTADDRESS$ -e '200 OK' -H $_HOSTFQDN_ENROUTE-ROUTE$ -u https://$_HOSTFQDN_ENROUTE-ROUTE$/api/Health -S