ifdesc=alias problems with Mrtg cfgmaker

Today I had problem with MRTG’s cfgmaker. When I used the parameter ifdesc=alias it didn’t pick up the correct SNMP OID’s, instead it defaulted to ifdesc=desc. Hmm, very strange. Then I started to investigate the problem and found out that cfgmaker can be debugged because it is a perl script.

To be able to debug cfgmaker you only have to edit one line at the top of the program.
@main::DEBUG=qw(base snpo snpd);

After doing this I ran cfgmaker again and spotted that it did not do any SNMP walk on alias (ifAlias). It turns out that cfgmaker has to know what kind of hardware it is polling to be able to use ”alias”. In my case I was polling an ”Ericsson SSR 8020” which wasn’t recognized by cfgmaker.

I had to add ”Ericsson” to the vendor identification list. If your hardware is not in that list, you can’t use the alias option.

# vendor identification
my %vendorIDs = (
# Add your vendor here
# sysObjectID Vendora
'' => '3com',
'' => 'hp',
'' => 'cisco',
'' => 'dellLan',
'' => 'extremenetworks',
'' => 'foundry',
'' => 'force10',
'' => 'juniper',
'' => 'nokiaipsofw',
'' => 'portmaster',
'' => 'ericsson'
foreach (keys %vendorIDs) {
$DevInfo{Vendor} = $vendorIDs{$_} if ($DevInfo{sysObjectID} =~ /\Q$_\E/);
debug('base',"Vendor Id: $DevInfo{Vendor}");

Then ericsson had to be added to the InterfaceInfo subroutine:

if ($routers->{$router}{deviceinfo}{Vendor} eq 'cisco' &&
$routers->{$router}{deviceinfo}{sysDescr} =~ m/Version\s+(\d+\.\d+)/) {
push @Variables, ($1 > 11.0 or $1 < 10.0 ) ? "ifAlias" : "CiscolocIfDescr"; if ($1 > 11.2) {push @Variables, "vmVlan";};
if ($1 > 11.3) {push @Variables, "vlanTrunkPortDynamicStatus";};
} elsif ( $routers->{$router}{deviceinfo}{Vendor} =~ /(?:hp|juniper|foundry|dellLan|force10|3com|extremenetworks|ericsson)/) {
push @Variables, "ifAlias";

Then it worked! cfgmaker finally walked ifAlias for the interfaces.

2 reaktioner till “ifdesc=alias problems with Mrtg cfgmaker”

  1. That is exactly the information I needed. I now have meaningful interface descriptions with my mrtg graphs :-)

    Thank you very much!

Lämna ett svar

Din e-postadress kommer inte publiceras. Obligatoriska fält är märkta *

Denna webbplats använder Akismet för att minska skräppost. Lär dig hur din kommentardata bearbetas.