SNMP Oddity
Hi all,
Not sure if this is on topic or not.
I’m trying to query an SNMP value from CentOS 6 and I get a bad response if I don’t specify the MIB to use:
0 digimer@pulsar:~/anvil/striker$ snmpget -v2c -c public -m
/home/digimer/Downloads/APC/AP7900/MIB/powernet421.mib 10.255.2.1
.1.3.6.1.2.1.2.2.1.6.2
RFC1213-MIB::ifPhysAddress.2 = Hex-STRING: 00 C0 B7 5F 8A 85
0 digimer@pulsar:~/anvil/striker$ snmpget -v2c -c public 10.255.2.1
.1.3.6.1.2.1.2.2.1.6.2
IF-MIB::ifPhysAddress.2 = STRING: 0:c0:b7:5f:8a:85
Note the second reply is not returning the first character (should be
’00:’, returning ‘0:’.
Trying to request Hex doesn’t seem to help, either:
0 digimer@pulsar:~/anvil/striker$ snmpget -v2c -c public -Ox
10.255.2.1 .1.3.6.1.2.1.2.2.1.6.2
IF-MIB::ifPhysAddress.2 = STRING: 0:c0:b7:5f:8a:85
Any SNMP folks know what I might be doing wrong?
Thanks!
—
Digimer Papers and Projects: https://alteeve.com/w/
“I am, somehow, less interested in the weight and convolutions of Einstein’s brain than in the near certainty that people of equal talent have lived and died in cotton fields and sweatshops.” – Stephen Jay Gould
2 thoughts on - SNMP Oddity
use
net-snmp-config –default-mibdirs
to locate where the mib file can be dropped so that snmp can use them. copy the mib file to one of the paths returned. mine usually end up in:
/usr/share/snmp/mibs
net-snmp-config –snmpconfpath
To find the snmp config files
Add the mib to the snmp.conf file. Mine looks like this:
mibs +ALL
mibs +ASTERISK-MIB
mibs /usr/share/snmp/mibs/powernet419.mib
you can simplify the line by looking at the mib file for this:
PowerNet-MIB DEFINITIONS ::= BEGIN
and then the config file can be this:
mibs +ALL
mibs +ASTERISK-MIB
mibs +PowerNet-MIB
To use the form above, the file has to be like this
/usr/share/snmp/mibs/powernet419-mib.txt
You can also use the MIBS environment variable to specify things:
MIBS=+CISCO-RHINO-MIB:SOME-OTHER-SPIFFY-MIB
export MIBS
I’d guess this is the raw string transported over the wire. The MIB likely translates to proper MAC formatting. `tcpdump’ should uncover this.