[mrtg-developers] PATCH: Monitor OIDs where ifIndex is not in last position

Schnitter, Stefan Stefan.Schnitter at t-systems.com
Wed Nov 22 18:31:03 MET 2006


Dear all,

We would like to monitor OIDs with mrtg that don't have the ifIndex in
the last position.
One example is cIpMRouteInterfaceHCInMOctets (which is not a standard
mib yet, but other similar examples exist). For ifIndex 99 we would have
to query cIpMRouteInterfaceHCInMOctets.99.ipv4 (or
.1.3.6.1.4.1.9.10.117.1.1.4.1.10.99.1)
Obviously we can explicitly specify the OID including the ifIndex within
the target definition but - of course - we'd prefer to use the
"interface by IP" method since the ifIndex is no static value. 
The Problem with the current implementation is that /1.2.3.4 only
appends the ifIndex at the end.

I've written a (very) small patch that would allow all the "Interface by
Name/IP/Description" methods to insert the ifIndex at an arbitrary
position within the OID. The target definition would look like this 

Target[router-int]:
.1.3.6.1.4.1.9.10.117.1.1.4.1.10.IndexPOS.1/1.2.3.4&.....

The keyword "IndexPOS" will be replaced by the ifIndex that belongs to
the given IP address.
The patch is very short (see below) and uses the same mechanism that is
now used for the WaLK keyword (just before the snmpget we replace
IndexPOS with the ifIndex)

Questions are:
- Is it correct that there's no other solution in the existing
implementation?
- would you consider including this patch in some future release ?

TIA,
 Stefan


#### Diff against mrtg-2.14.7 ###############

....mrtg-2.14.7/bin> diff mrtg mrtg.new
2030c2030
<     my @snmpoids = grep !/^(Pseudo|WaLK|GeTNEXT)/, @OID;
---
>     my @snmpoids = grep !/^(Pseudo|WaLK|GeTNEXT)|IndexPOS/, @OID;
2047a2048,2049
>         /IndexPOS.*\.(\d*)/ && do { my $idx=$1; s/IndexPOS/$idx/;
s/\.\d*$//; push @newret, snmpget($targtemp,$$target{snmpoptions},$_);
>                           debug('snpo', "snmpget of oid '$_' after
replace for IndexPOS"); next};

....mrtg-2.14.7/lib/mrtg2> diff MRTG_lib.pm MRTG_lib.pm.new
1285c1285
<               '([-a-zA-Z0-9]*(?:\.\d+)*?)' .  # OID possibly starting
with a MIB name ($if->{OID})
---
>               '((?:\.\d+)*?\.?[-a-zA-Z0-9]*(?:\.\d+)*?)' .    # OID
possibly starting with a MIB name ($if->{OID})

 
--
Dr. Stefan Schnitter
T-Systems Enterprise Services GmbH, SSC ENPS, PCT11sts
Traffic Management & Network Optimization
Phone: +49 (0) 6151 937-8521


--
Unsubscribe mailto:mrtg-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:mrtg-developers-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/mrtg-developers



More information about the mrtg-developers mailing list