Page 1 of 1

[Nagios-devel] Nagios template configuration question

Posted: Tue Mar 11, 2003 1:02 pm
by Guest
Hello list,

I was recently installing and configuring Nagios 1.0 and I came across
an idea. If this has been tried already, my apologies. I did actually
read the documentation :)

My goal is to be able to set a variable that can be used in a service
definition. I think of the templates as macros, and I want to be able
to reuse service definitions. I think the best way to describe this is
code examples, so here goes

define command{
command_name check_http_regex
command_line $USER1$/check_http -H $HOSTADDRESS -p $ARG1$ -u
$ARG2$ -w 3 -c 7 -r $ARG3$
}

# Using the port number as ARG1, the relative URL as ARG2, and the regex
# to check for as ARG3.

define service{
name WEBSERVICE
service_description Webserver REGEX Check
check_command check_http_regex!$port$!$url$!$regex$
register 0
use default_settings
}
]

# Here begins the REAL service definition

define service{
name webserver
service_description Generic Website
port 8080
url /test/index.php
regex 'teststring'
use WEBSERVICE
}

This would make my configuration easier to read as well as add new
entries. I would not have to redefine the check_command every time and
the args would be plainer (I wouldn't have to look so deeply when I come
back in 6 months to remember what each arg does).

Is this possible now? If not, would it be easy to add?

Thanks in advance,

-BAK
--
Ben Klang, KF4WBX
Unix Administrator
[email protected]









This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]