loading host specific variables?

Christian Schneemann cschneemann at suse.de
Tue Jul 28 13:33:33 CEST 2009


On Tuesday July 28 2009 01:21:46 pm ibloodyhatespam at gmail.com wrote:
> Well, next to the regular servers.cfg, commands_check.cfg,
> commands_definition.cfg etc etc etc there are a couple of things that are
> different between hosts (notably event handlers), making one the master
> host and one the slave host.
>
> I've already created a hostname1.cfg and a hostname2.cfg containing the
> host and service definitions that differ, but I'd like nagios to read
> either of these based on the current machine hostname, instead of having to
> manually edit nagios.cfg after copying cfgs over from the master host to
> the slave host.
You could create different config-dirs in your configuration, one for each 
server and just add the directory on that server, that should use the 
configuration from that directory.

server1:
/etc/nagios/objects/server1_configs/ <-- added as config_dir to nagios.cfg
/etc/nagios/objects/server2_configs/
/etc/nagios/objects/other_configs/ <-- added as config_dir to nagios.cfg

server2:
/etc/nagios/objects/server1_configs/
/etc/nagios/objects/server2_configs/ <-- added as config_dir to nagios.cfg
/etc/nagios/objects/other_configs/ <-- added as config_dir to nagios.cfg

Would that be an option?

Greetings,
 Christian


-- 
Christian Schneemann
Operations & Services
-------------------------------------
SUSE LINUX Products GmbH,
Maxfeldstr. 5, D - 90409 Nürnberg

Phone:  +49 (0)911 - 740 53 0
e-mail: cschneemann at suse.de
-------------------------------------
SUSE LINUX Products GmbH, GF: Markus Rex
HRB 16746 (AG Nürnberg)

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
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