mixtli / net-snmp

ruby library for snmp. uses ffi to connect to net-snmp libs
MIT License
28 stars 14 forks source link

print_varbind: Use the correct OID size for OIDs #6

Open ernie opened 10 years ago

ernie commented 10 years ago

Looks like some code is still reading varbinds as long regardless of type. Apologies for not including a test, but the test harness keeps segfaulting for me on my machine.

ernie commented 10 years ago

Incidentally, stumbled upon this while trying to track down some way to get named number lists to translate to their names. Given, for instance:

ltmPoolStatusAvailState OBJECT-TYPE 
    SYNTAX INTEGER {
        none(0),
        green(1),
        yellow(2),
        red(3),
        blue(4),
        grey(5)
    }
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION
        "The availability of the specified pool indicated in color.
        none - error;
        green - available in some capacity;
        yellow - not currently available;
        red - not available;
        blue - availability is unknown;
        gray - unlicensed"
    ::= { ltmPoolStatusEntry 2 } 

I can only retrieve an integer value from the varbind, but Net-SNMP's snmpget returns:

F5-BIGIP-LOCAL-MIB::ltmPoolStatusAvailState."a_string" = INTEGER: green(1)