Page 1 of 1

unable to use resource.cfg variable

Posted: Tue Nov 19, 2013 11:12 am
by kendallchenoweth
I have a nagios XI instance and a variable defined in the /usr/local/nagios/etc/resource.cfg (see below). When I use that variable in the nagios XI core config manager as an arguement to configure a check, it doesn't work. The "test" option fails as well as the actual check. I'm putting the value in the ARG1 field as $USER9$. Should the test option work? Can the Nagios XI web instance read the resource.cfg variables?

[root@localhost etc]# more resource.cfg
# Path to the plugins
$USER1$=/usr/local/nagios/libexec

# Path to event handlers
#$USER2$=/usr/local/nagios/libexec/eventhandlers

# Port for NSClient++
$USER7$=12489
# Password for NSClient++
$USER8$=secret

$USER9$=token

Thanks

-Kendall Chenoweth

Re: unable to use resource.cfg variable

Posted: Tue Nov 19, 2013 12:00 pm
by slansing
Can you show us the service and command definition for this check?

Re: unable to use resource.cfg variable

Posted: Tue Nov 19, 2013 3:46 pm
by kendallchenoweth
resource.cfg

Code: Select all

# Path to the plugins
$USER1$=/usr/local/nagios/libexec

# Path to event handlers
#$USER2$=/usr/local/nagios/libexec/eventhandlers

# Port for NSClient++
$USER7$=12489
# Password for NSClient++
$USER8$=secret

$USER9$=token
commands.cfg

Code: Select all

...
define command {
       command_name                             check_xi_ncpa_agent
       command_line                             $USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
}
...
bytes_sent.cfg

Code: Select all

###############################################################################
#
# Service configuration file
#
# Created by: Nagios QL Version 3.0.3
# Date:	      2013-11-19 10:22:39
# 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			kchenowe-ubuntu.dhcp.mathworks.com
	service_description		NCPA Outbound Bandwidth on eth0
	use				xiwizard_ncpa_service
	hostgroup_name			linux-servers
	display_name			bytes_sent
	check_command			check_xi_ncpa_agent!-t '$USER9$' -P 5693 -M 'interface/eth0/bytes_sent' -d -u M -w
 10 -c 100!!!!!!!
	initial_state			o
	max_check_attempts		2
	check_interval			1
	retry_interval			1
	active_checks_enabled		0
	passive_checks_enabled		1
	check_period			xi_timeperiod_24x7
	obsess_over_service		1
	check_freshness			1
	freshness_threshold		300
	flap_detection_enabled		1
	process_perf_data		1
	retain_status_information	1
	retain_nonstatus_information	1
	notification_interval		60
	first_notification_delay	0
	notification_period		xi_timeperiod_24x7
	notification_options		u,r,f,
	notifications_enabled		1
	contacts			nagiosadmin
	stalking_options		o,c,
	_xiwizard			ncpa
	register			1
	}	

###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################

Re: unable to use resource.cfg variable

Posted: Tue Nov 19, 2013 5:18 pm
by slansing
What is the output you get when using that command?