[mrtg] Interface Index Independence Problem solved..

Sandu Mihai mihai at romania.eu.net
Tue Sep 19 15:28:32 MEST 2000

OIDS problem solved.
There are some OIDs that encompasses an interface index as their part.
There are also some that end in an interface index.
For these, MRTG works like a charm, with the x.x.x/a.a.a.a syntax.
MRTG, using a regexp { /(^.+)\/(.+$)/ } extracts the IP address (a.a.a.a)
the main OID body (x.x.x.x), then looks up the interface index using the IP
and constructs the 'normal' OID by doing something like:
$oid= 'x.x.x.x'.'.'.$index

So, x.x.x.x/a.a.a.a -> x.x.x.x.I

So far, so good for OIDs ending in interface index like ifOutError and the
The main problem still remains for OIDs that have an interface index in
their body.

Like for example the Cisco CAR variables. And that, because, on an Cisco
you can have x ACLs and you want the number of packets or bytes dropped or
as a result of these ACLs. An OID for that will look like:


So, we extend the old syntax to a new one. x.x.x.x/a.a.a.a becomes
while we must also remain compatible with the old stuff.


x.x.x.x/a.a.a.a/y.y.y  -> For x.x.x.I.y.y.y
x.x.x.x/a.a.a.a -> For x.x.x.I

Current REGEXP


Works for:

New Regexp.


Test Perl Program

$text = shift || die "Please be kind and supply the test string...\n";
if($text =~ m/^([^\/]+)\/([^\/]+)\/?([^\/]*)$/){
        print "1: $1\n";
        print "2: $2\n";
        print "3: $3\n";
        print "4: $4\n";
        print "5: $4\n";
                print  "OID:".$1."-I-".$3."\n";
        } else {
                print "OID:".$1."=I="."\n";
} else {
        print "Regexp failed at ".$text."\n";

So. You got three parts now.
1) x.x.x.x (must be there)
2) a.a.a.a (must be there)
3) y.y.y.y (might be missing. It's ok if it is missing)

The mrtg code remains intact, apart from the regexp and reconstruction.

I will post also patches against latest stable mrtg.

All my best,
	Sandu Mihai - KPNQwest Romania Network Engineer

Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

More information about the mrtg mailing list