Bug: resources in service definitions
Matt Pounsett
matt.pounsett at cira.ca
Mon Feb 9 21:00:20 CET 2004
I've posted about this before, looking for confirmation from others. I
haven't received any replies yet.. but I've done some more research and I'm
now convinced this is a bug. Could I get someone to try to duplicate this,
and let me know if they're successful? This all pertains to Nagios 1.1,
compiled from source, running on RedHat 7.3 and RedHat Edge Server 3.0.
It would appear that variables defined in resources.cfg cannot be used inside
service object definitions.. only in command definitions. When used inside
service definitions, the value that gets passed is always "$", rather than the
value assigned to the variable.
I first noticed this when I tried to set up a general mySQL check command. I
have several different mySQL servers to check, some with different admin
passwords, which means that it's easiest for me to define one check command,
and put the user/pass in several sets of resources, specified within the
service definition, like so:
resources.cfg:
--------------
$USER3$=mysqlroot
$USER4$=mysqlpass
services.cfg:
--------------
define service {
use templateServiceGeneric
host_name sqlserver.domain.com
service_description MySQL
check_command check_mysql!$USER3$!$USER4$
contact_groups sysadmins
}
commands.cfg:
---------------
define command {
command_name check_mysql
command_line $USER1$/check_mysql -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$
}
However... when I do it this way, the command that is eventually run is:
/usr/local/nagios/libexec/check_mysql -H xx.xx.xx.xx -u $ -p $
If I replace $USER3$ for $ARG1$ and $USER4$ for $ARG2$ in the check command,
I get this (as expected):
/usr/local/nagios/libexec/check_mysql -H xx.xx.xx.xx -u mysqlroot -p mysqlpass
So, in order to get this to work, without exposing passwords via the CGI
interfaces, I've had to create several check commands for mySQL -- one for
each server.
Could someone from the development team confirm whether this is a bug, a
misinterpretation on my part of the documentation (which seems to suggest I
should be able to use resources in service definitions), or some other
intentional limitation in the use of resources?
Thanks,
Matt Pounsett
--
Matt Pounsett CIRA - Canadian Internet Registration Authority
Technical Support Programmer 350 Sparks Street, Suite 1110
matt.pounsett at cira.ca Ottawa, Ontario, Canada
613.237.5335 ext. 231 http://www.cira.ca
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
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