Sharing local/remote machine .cfg

Marc Powell marc at ena.com
Thu Jun 21 17:08:27 CEST 2007



> -----Original Message-----
> From: nagios-users-bounces at lists.sourceforge.net [mailto:nagios-users-
> bounces at lists.sourceforge.net] On Behalf Of Alain Williams
> Sent: Thursday, June 21, 2007 9:50 AM
> To: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] Sharing local/remote machine .cfg
> 
> I am relatively new to Nagios, I am setting up a group of Linux
machines
> that
> all send reports to a central monitoring one with nsca.
> 
> I have a separate .cfg file for each machine, I would like to share
this
> file
> between remote and central machines - so that if I change anything I
just
> copy it over.
> 
> One change that *is* needed is the value of active_checks_enabled -
which
> is zero
> on the central box and one on the remote.
> 
> I tried something like this in a 'define service':
> 
> 	active_checks_enabled           $USER11$
> 
> and elsewhere had:
> 
> 	$USER11$=1
> or
> 	$USER11$=0
> 
> as appropriate for the machine.
> 
> This does not work. Why ? and is there a way of achieving what I want
to
> do ?

Macros are only available to command {} definitions. You can't use them
anywhere else.

What I do is to create a template in a new config file (templates.cfg
for example) with the differing values and the hosts/services inherit
that template. Something like --

Central machine -
define host {
	name	host-active-checks
	active_checks_enabled	1
	register 0
}
define service {
	name service-active-checks
	active_checks_enabled 1
	register 0
}

Remote machine -
define host {
	name	host-active-checks
	active_checks_enabled	0
	register 0
}
define service {
	name service-active-checks
	active_checks_enabled 0
	register 0
}

Then your shared file would use

define host {
	use	host-active-checks
	... other host specific stuff ...
}
define service {
	use service-active-checks
	... other service specific stuff ...
}

--
Marc

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
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