I deliberately decided not to implement more switches for SNMP parameters but rather to use (automatically if present) a file named snmpopts.cf instead. Just put Version = 1 into that one.
--Peter -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 26, 2002 7:10 PM To: HOLZLEITNER, Peter; [EMAIL PROTECTED] Subject: RE: snmpvar not working? Peter, Here is a simple patch to snmpvar.monitor to allow the version number to be passed as an argument. Every Red Hat 7.3 machine I try this on requires me to do this, I don't know if there is a better way, but this simple patch (and using the "--version=1" argument) solves all my problems. --- snmpvar.monitor Tue Nov 26 09:39:45 2002 +++ snmpvar.monitor.new Tue Nov 26 09:40:42 2002 @@ -16,7 +16,7 @@ # # [--community=cmn] [--group=groups] [--timeout=n] [--retries=n] # [--varconf=variableconfig] [--config=configfile] [--debug] -# [--mibs='mib1:mib2:mibn'] [--list[=linesperpage]] host [host ...] +# [--mibs='mib1:mib2:mibn'] [--version='1:2c:3'] [--list[=linesperpage]] host [host ...] # # For every host name passed on the command line, snmpval.monitor looks # up the list of variables and corresponding limits in the configuration @@ -103,7 +103,7 @@ sub Decode; GetOptions (\%opt, "community=s", "groups=s", "timeout=i", "varconf=s", - "config=s", "mibs=s", "retries=i", "list:i", "debug"); + "config=s", "version=s", "mibs=s", "retries=i", "list:i", "debug"); die "no host arguments\n" if (@ARGV == 0); @@ -113,6 +113,7 @@ $COMM = $opt{'community'} || 'public'; $TIMEOUT = $opt{'timeout'} * 1000 * 1000 || 5000000; $RETRIES = $opt{'retries'} || 8; +$VERSION = $opt{'version'} || '3'; $VARCONF = $opt{'varconf'} || (-d '/etc/mon' ? '/etc/mon' : '/usr/lib/mon/etc') . '/snmpvar.def'; $MONCONF = $opt{'config'} || (-d '/etc/mon' ? '/etc/mon' : '/usr/lib/mon/etc') @@ -145,7 +146,7 @@ next unless $VARS; if (!defined($s = new SNMP::Session (DestHost => $host, - Timeout => $TIMEOUT, Community => $COMM, Retries => $RETRIES))) { + Timeout => $TIMEOUT, Version => $VERSION, Community => $COMM, Retries => $RETRIES))) { $RET = 2 unless $RET > 2; push (@HOSTS, $host); push (@ERRS, "could not create session to $host: " . $SNMP::Session::ErrorStr); --L >From: [EMAIL PROTECTED] (Peter HOLZLEITNER) >To: [EMAIL PROTECTED] >Subject: RE: snmpvar not working? >Date: Mon, 25 Nov 2002 23:46:02 +0100 > > >Do I need to specify the version somewhere? > >Not unless you changed the default from 1 in the SNMP options >config file (or your version of NetSNMP did). You could use >that file to set the version (see change log). > >--Peter > >_______________________________________________ >mon mailing list >[EMAIL PROTECTED] >http://linux.kernel.org/mailman/listinfo/mon _________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail _______________________________________________ mon mailing list [EMAIL PROTECTED] http://linux.kernel.org/mailman/listinfo/mon _______________________________________________ mon mailing list [EMAIL PROTECTED] http://linux.kernel.org/mailman/listinfo/mon