Re: [Mon-devel] Re: Best way to contribute
Brought to you by:
trockij
From: David N. <vit...@cm...> - 2004-07-01 15:44:02
|
--On Thursday, July 01, 2004 8:59 AM -0500 Tim Klein <tkp...@ti...> wrote: > > I don't know about any other site-specific mods you may have made, > but the one you describe above certainly sounds to be of general > interest. Ok. In the interest of figuring out our solution is reasonable for other people I'll give some more details. The config file contains arbitrary variables, that can either apply to specific hostgroups, services, hostgroup & service pairs, or be default values. In certain cases we even can provide per-machine settings. Examples of settings we use this for are: snmp community strings, database users & passwords, username & password for testing kerberos servers, paths to keytab files, etc. Here's an example of the way it works. The mon script has a block of code like this: my %communities; my $group=$ENV{MON_GROUP}; my $service=$ENV{MON_SERVICE}; my $cf; $community ||= $opt{'community'}; if ($cf = new IO::File "</home/mon/etc/monitor-auth.cf") { while (<$cf>) { chomp; if (/^(\S+):readcommunity\s*=\s*(\S+)$/) { $communities{$1}=$2; } } $community ||= $communities{"$group:$service"}; $community ||= $communities{"$group:*"}; $community ||= $communities{"*:$service"}; $community ||= $communities{"*:*"}; } $community ||= 'public'; Then monitor-auth.cf contains entries like this: hostgroup-x:*:readcommunity=foobar hostgroup-y:*:readcommunity=qux *:service-x:readcommunity=baz hostgroup-y:service-x:readcommunity=abc *:*:readcommunity=asdf -David David Nolan <*> vit...@cm... curses: May you be forced to grep the termcap of an unclean yacc while a herd of rogue emacs fsck your troff and vgrind your pathalias! |