[Mon-commit] mon/mon.d snmpvar.monitor,1.1.2.1,1.1.2.2
Brought to you by:
trockij
From: Jim T. <tr...@us...> - 2004-12-15 15:24:43
|
Update of /cvsroot/mon/mon/mon.d In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16539/mon.d Modified Files: Tag: mon-1-0-0pre1 snmpvar.monitor Log Message: get conf from MON_CFBASEDIR Index: snmpvar.monitor =================================================================== RCS file: /cvsroot/mon/mon/mon.d/snmpvar.monitor,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** snmpvar.monitor 28 Jun 2004 14:38:00 -0000 1.1.2.1 --- snmpvar.monitor 15 Dec 2004 15:24:17 -0000 1.1.2.2 *************** *** 37,41 **** # # This monitor looks for configuration files in the current directory, ! # in /etc/mon and /usr/lib/mon/etc. Command line option --varconf # overrides the location of the variable definition file, option # --config sets the configuration file name. --- 37,42 ---- # # This monitor looks for configuration files in the current directory, ! # in the environment variable supplied by the mon server (MON_CFBASEDIR), ! # /etc/mon, and /usr/lib/mon/etc. Command line option --varconf # overrides the location of the variable definition file, option # --config sets the configuration file name. *************** *** 110,113 **** --- 111,115 ---- sub GetSNMPArgs; sub Decode; + sub find_conf_dir; GetOptions (\%opt, "config=s", "groups=s", "varconf=s", *************** *** 126,137 **** openlog('snmpvar.mon', 'cons,pid', 'daemon'); - # find config files ! $CF1 = '/etc/mon'; ! $CF2 = '/usr/lib/mon/etc'; ! $VARCONF_FILE = (-d $CF1 ? $CF1 : $CF2) . '/snmpvar.def'; ! $MONCONF_FILE = (-d $CF1 ? $CF1 : $CF2) . '/snmpvar.cf'; ! $SNMPCONF_FILE = (-d $CF1 ? $CF1 : $CF2) . '/snmpopt.cf'; # pick up local config files for testing --- 128,137 ---- openlog('snmpvar.mon', 'cons,pid', 'daemon'); # find config files ! @CFDIRS = ($ENV{"MON_CFBASEDIR"}, '/etc/mon', '/usr/lib/mon/etc'); ! $VARCONF_FILE = find_conf_dir (@CFDIRS) . '/snmpvar.def'; ! $MONCONF_FILE = find_conf_dir (@CFDIRS) . '/snmpvar.cf'; ! $SNMPCONF_FILE = find_conf_dir (@CFDIRS) . '/snmpopt.cf'; # pick up local config files for testing *************** *** 147,152 **** print STDERR "\nsnmpvar.monitor: configured from $VARCONF_FILE, $MONCONF_FILE\n\n" if $opt{'debug'}; ! ReadVarDef($VARCONF_FILE) || die "could not read variable definition: $!\n"; ! ReadVarList($MONCONF_FILE) || die "could not read config: $!\n"; ReadSNMPConf($SNMPCONF_FILE); # this is optional stuff --- 147,152 ---- print STDERR "\nsnmpvar.monitor: configured from $VARCONF_FILE, $MONCONF_FILE\n\n" if $opt{'debug'}; ! ReadVarDef($VARCONF_FILE) || die "could not read variable definition $VARCONF_FILE: $!\n"; ! ReadVarList($MONCONF_FILE) || die "could not read config $MONCONF_FILE: $!\n"; ReadSNMPConf($SNMPCONF_FILE); # this is optional stuff *************** *** 468,471 **** --- 468,484 ---- + sub find_conf_dir + { + my @dirs = @_; + + foreach my $d (@dirs) + { + return $d if (-d $d); + } + + return ""; + } + + format STDOUT_TOP = Host Variable min value max stat |