Re: [Nagios-devel] Nagios template configuration question
Posted: Thu Mar 13, 2003 9:18 am
On 11 Mar 2003, Ben Klang wrote:
> 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
The code currently looks at the service definition as a struct with a
defined number of members (some of which may have a null value). Adding
more members to the struct on an arbitrary basis would mean moving from
structs to another (perhaps linked list) implementation. That would
require ripping out the guts so I think it is unlikely in the near future.
--
-sg
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
> 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
The code currently looks at the service definition as a struct with a
defined number of members (some of which may have a null value). Adding
more members to the struct on an arbitrary basis would mean moving from
structs to another (perhaps linked list) implementation. That would
require ripping out the guts so I think it is unlikely in the near future.
--
-sg
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]