Attempting to Use Multiple Variables in Service Template

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
mrochelle
Posts: 238
Joined: Fri May 04, 2012 11:20 am
Location: Heart of America

Attempting to Use Multiple Variables in Service Template

Post by mrochelle »

Hello, I've in the process of attempting to use either a host variable or free variable in a service check for monitoring Microsoft queues using a service template but am having a problem with the resolution of either variable type used. Following is the actual service check using the Host free variable:
check_msmqv6_SITE!"MessageCount $HOSTALIAS$\\private$\\commandpayloadprocessorhost_$_HOSTSITE$/commandpayloadprocessorservice.svc 250 500"!!!!!!!

When this command is processed in the nagios xi gui, following is how it is resolved:
Server_FQDN\private$\commandpayloadprocessorhost_$/commandpayloadprocessorservice.svc

As you can see, the free variable $_HOSTSITE$ fails to resolve. I know it's possible that it may be some type of syntax problem with this specific command but I have used the free variable in a number of other service templates without a problem. It appears to be related to the position of the varible in the command. As a test, if I reverse the position of the host free variable with the host variable ($HOSTALIAS$) then the host variable fails to resolve. Reference below:

Host_free_variable\private$\commandpayloadprocessorhost_$/commandpayloadprocessorservice.svc

There appears to be some issue with resolution of the variables toward the middle of the command. I may be trying to perform something that is not allowed. Is it possible to use multiple variables in a single command?
Comments, thoughts are appreciated.
regards, Marcus :geek:

System:
Nagios XI Version : 5.4.13
usiadvs5731.am.bm.net 2.6.32-696.el6.x86_64 x86_64
CentOS release 6.9 (Final)
Gnome is not installed
Apache Information
PHP Version: 5.3.3
Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36
Server Name: x.x.x.31
Server Address: x.x.x.31
Server Port: 443
Date/Time
PHP Timezone: America/Chicago
PHP Time: Thu, 31 May 2018 13:43:10 -0500
System Time: Thu, 31 May 2018 13:43:10 -0500
Nagios XI Data
License ends in: [Redacted]

nagios (pid 109274) is running...
NPCD running (pid 2612).
ndo2db (pid 2649) is running...
CPU Load 15: 0.46
Total Hosts: 43
Total Services: 1686
Function 'get_base_uri' returns: https://IP/nagiosxi/
Function 'get_base_url' returns: https://IP/nagiosxi/
Function 'get_backend_url(internal_call=false)' returns: https://IP/nagiosxi/includes/components ... rofile.php
Function 'get_backend_url(internal_call=true)' returns: https://localhost/nagiosxi/backend/
Last edited by tmcdonald on Thu May 31, 2018 1:49 pm, edited 1 time in total.
Reason: Please do not post license details in the forum
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Attempting to Use Multiple Variables in Service Template

Post by scottwilkerson »

This $ isn't escaped

Code: Select all

private$
and likely throws everything after it off
https://support.nagios.com/kb/article.php?id=580
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
mrochelle
Posts: 238
Joined: Fri May 04, 2012 11:20 am
Location: Heart of America

Re: Attempting to Use Multiple Variables in Service Template

Post by mrochelle »

I'll buy next time we meet! Lock it up. That took care of it. :D
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Attempting to Use Multiple Variables in Service Template

Post by scottwilkerson »

mrochelle wrote:I'll buy next time we meet! Lock it up. That took care of it. :D
I'm gonna hold you to that :lol:

Glad it is resolved.

Locking
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked