Is it possible to get net-snmp's snmpd to return an interface
description for ifAlias[1]? If so, how?
I am sure that it is, but I am hoping that someone has an example
because I am not sure how to figure out how to match it to the
interfaces ifIndex value.
It looks like net-snmp 5.2 there is going to be some ifXTable support
for Red Hat. However, I only want ifAlias for MRTG, so has anyone done
anything like that? or does this need to go on my "free time" list?
It appears that the entries in ifTable[3] are in the same order that
ifconfig outputs. Does anyone know if that is the case for sure? If
so, a script to do what I want shouldn't be too tough.
I tried adding this to my /etc/snmpd.conf:
# A good attemt, too bad it failed.
exec .1.3.6.1.2.1.31.1.1.1.18 /home/andrew/ifAlias
where the ifAlias script is this:
#!/bin/sh
# The whitespace in the grep is a tab
INTERFACES=`ifconfig | grep -v "^ " | sed 's/:.*$//'`
for i in ${INTERFACES}; do
ifconfig $i | grep description | sed -e 's/^.*description:.//'
done
Unfortunanately, that doesn't work :-(
$ snmpwalk -v1 -c public testhost .1.3.6.1.2.1.31.1.1.1.18
IF-MIB::ifAlias.1.1 = Wrong Type (should be OCTET STRING): INTEGER: 1
IF-MIB::ifAlias.2.1 = STRING: /home/andrew/ifAlias
IF-MIB::ifAlias.3.1 = STRING:
IF-MIB::ifAlias.100.1 = Wrong Type (should be OCTET STRING): INTEGER: 1
IF-MIB::ifAlias.101.1 = STRING: No such file or directory
IF-MIB::ifAlias.102.1 = Wrong Type (should be OCTET STRING): INTEGER: 0
IF-MIB::ifAlias.103.1 = STRING:
So, that probably means writing a script to do pass through control[5] and
that looks to be a bit of a pain, so I am hoping someone has one already.
[1] .1.3.6.1.2.1.31.1.1.1.18 [2]
[2]
.iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias
[3] .1.3.6.1.2.1.2.2 [4]
[4] .iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable
[5] look here[6] for MIP-Specific Extension Commands
[6] http://www.net-snmp.net/docs/man/snmpd.conf.html
l8rZ,
--
andrew - ICQ# 253198 - JID: [EMAIL PROTECTED]
Proud member: http://www.mad-techies.org
BOFH excuse of the day: Police are examining all internet packets in
the search for a narco-net-trafficker