resource.cfg user variable problem

Michael Eck meck at chilitech.net
Mon Mar 8 16:20:10 CET 2004


Greetings.
I'm using Nagios 1.1 on a Debian woody (stable) Linux box monitoring 
548 services on 132 hosts.

I'm trying to use $USERx$ variables for snmp community strings in my 
services.cfg file but having no luck.  My check returns status UNKNOWN 
- SNMP problem - No data received from host.  This seems like 
appropriate behavior for a wrong/missing community string.

I have my resource.cfg defined in nagios.cfg:
resource_file=/home/nagios/etc/resource.cfg

I have my community string defined in my resource.cfg:
$USER6$=mystring (with non-alpha-numeric characters)

And my service check command:

define service{
	use				uptime
	check_command	check_uptime!$USER6$
	host_name		faste_on_router
}

...as defined in checkcommands.cfg
# 'check_uptime' snmp check command definition
# $ARG1 = snmp-community-string
define command{
         command_name    check_uptime
         command_line    $USER1$/check_snmp -H $HOSTADDRESS$ -o 
system.sysUpTime.
0 -C $ARG1$
         }


If I run it from the command line replacing the $USER6$ variable with 
the actual community string it works.  I have two suspicions.  First - 
$USER2$-$USER5$ are not defined.  Does nagios care?  Second, the 
community string in question end with an exclamation point (!).  could 
this perhaps be fudging something in the check_command because nagios 
is seeing the ! as a delimiter?  This doesn't seem to be the case.  
After a little bit of playing around I set $USER4$=public in my 
resources.cfg file and changed the check_uptime command definition for 
those hosts that use 'public' as their ro community string.  The same 
check_uptime fails with that community string as a variable.  When I 
replace it with the actual text 'public' it works fine.

Has anybody else had luck using the resource.cfg file for community 
strings in check commands?

Michael Eck
Chilitech Internet Solutions
meck at chilitech.net



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list