Use of Variables in Thresholds

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jhegie
Posts: 1
Joined: Wed Feb 19, 2014 5:12 pm

Use of Variables in Thresholds

Post by jhegie »

While migrating from Core to XI I've come across an issue with some old services that are being used to check some temperature monitors. The error that I'm getting is:
COMMAND: /usr/local/nagios/libexec/check_snmp -H cstemp2.servers.local -p 161 -o 1.3.6.1.4.1.16174.1.1.3.3.3.7.0 -C public -P 1 -w \$_HOSTHUM3\$ -c \$_HOSTHUM3\$ -u %
OUTPUT: check_snmp: Invalid warning threshold - $_HOSTHUM3$
The service contains:

Code: Select all

###############################################################################
#
# Service configuration file
#
# Created by: Nagios QL Version 3.0.3
# Date:       2014-03-26 15:30:16
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND --- 
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################

define service {
        host_name                       hvac-cs-2,hvac-cs-3
        service_description             Sensor 3 humidity
        use                             sensor-service-template
        check_command                   check_snmp!1.3.6.1.4.1.16174.1.1.3.3.3.7.0!$_HOSTHUM3$!$_HOSTHUM3$!%!!!!
        register                        1
        }       

###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################
And the host that I'm checking is:

Code: Select all

###############################################################################
#
# Host configuration file
#
# Created by: Nagios QL Version 3.0.3
# Date:       2014-03-26 15:30:16
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND --- 
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################

define host {
        host_name                       hvac-cs-2
        use                             sensor-host
        alias                           CS HVAC sensor bank 2
        address                         cstemp2.servers.local
        check_command                   check_ping!40!80!0!60!0!50!!
        _hum3                           0:60
        _hum3h                          60
        _temp1h                         80
        _temp1l                         40
        _temp3h                         80
        _temp3l                         40
        register                        1
        }

###############################################################################
#
# Host configuration file
#
# END OF FILE
#
###############################################################################
It looks like the '$' character is being escaped when the command runs, but I'm not seeing a way to force it to read the variable. This check works fine in our existing install of Core, but I haven't been able to get it to roll into XI. Is there a configuration setting that I've managed to miss, or a special way that I need to escape the '$' in the variable name?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Use of Variables in Thresholds

Post by lmiltchev »

Where did you define the $_HOSTHUM3$ and $_HOSTHUM3$ variables?

I did a very simple test with a couple of macros, and they seem to be working fine in XI (no escaping).

I have a "check_dir" command defined as:

Code: Select all

$USER1$/check_dir -d $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
My service definition:

Code: Select all

define service {
	host_name			localhost
	service_description		check_dir
	use				local-service
	servicegroups			linux-servers-all
	check_command			check_dir!/tmp!$_WAR$!$_CRI$!-f!!!!
	max_check_attempts		1
	check_interval			5
	retry_interval			1
	notification_interval		60
	first_notification_delay	0
	notification_options		c,r,
	notifications_enabled		1
	contacts			nagiosadmin
	_CRI				1000
	_WAR				500
	register			1
	}
example1.PNG
example2.PNG
You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked