[CentOS] SNMP oddity

Bruce Ferrell bferrell at baywinds.org
Fri Mar 24 06:38:22 UTC 2017


On 03/23/2017 10:20 PM, Digimer wrote:
> 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 at 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 at 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 at 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!
>
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






More information about the CentOS mailing list