0
$ export MIBS=
$ snmpget -Oqv -v 2c -c public 10.xxx.yyy.zzz .1.3.6.1.4.1.3375.2.1.14.3.2.0
"ACTIVE"

but

$ export MIBS=F5-BIGIP-SYSTEM-MIB
$ snmpget -Oqv -v 2c -c public 10.xxx.yyy.zzz .1.3.6.1.4.1.3375.2.1.14.3.2.0
ACTIVE

Why that difference in output when MIBS environment variables has a value?

Jdamian
  • 285
  • 3
  • 19

2 Answers2

1

The SNMP mib defines the data types for your SNMP OIDs, so with the MIB loaded it can display a "formatted" version of the value rather than displaying the raw value.

For example, compare:

MIBS= snmpget -v2c -c public 192.168.1.1 1.3.6.1.2.1.2.2.1.3.1
iso.3.6.1.2.1.2.2.1.3.1 = INTEGER: 24

With:

$ snmpget -v2c -c public 192.168.1.1 1.3.6.1.2.1.2.2.1.3.1
IF-MIB::ifType.1 = INTEGER: softwareLoopback(24)

When mibs are loaded, snmpget knows how to interpret the value.


In the particular case in your question, the mibs says, "display that value as a string".

larsks
  • 43,623
  • 14
  • 121
  • 180
1

To be more specific.

Without MIB documents, an SNMP tool can only tell the very basic data types defined by the protocol itself,

  • INTEGER
  • OCTET STRING
  • NULL
  • OBJECT IDENTIFIER
  • IpAddress
  • Counter32
  • Gauge32
  • TimeTicks
  • Opaque
  • NetAddress
  • Counter64

Since data are encoded in ASN.1 BER, the decoding algorithm can extract such data types from raw bytes over the wire.

Thus, when you run NET-SNMP's snmpget command without MIB documents, it merely decodes the data as OCTET STRING and prints as "ACTIVE".

However, MIB documents in SMI v1 or v2 allow customized data types to be defined upon such basic types via the so-called "Textual Conventions". And in your case, MIB document F5-BIGIP-SYSTEM-MIB defines the object .1.3.6.1.4.1.3375.2.1.14.3.2 as below,

sysCmFailoverStatusStatus OBJECT-TYPE 
    SYNTAX LongDisplayString
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION
        "The failover status on the system."
    ::= { sysCmFailoverStatus 2 }

The actual data type is LongDisplayString defined in F5-BIGIP-COMMON-MIB,

LongDisplayString ::= TEXTUAL-CONVENTION
    DISPLAY-HINT "1024a"
    STATUS       current
    DESCRIPTION  "A longer version of SNMPv2-TC::DisplayString."
    SYNTAX       OCTET STRING (SIZE (0..1024))

Thus, when you ask NET-SNMP snmpget command to load MIB documents, it is fully aware of the data type of LongDisplayString and prints ACTIVE.

So, you see even the only observable change is just the quotes, a lot happens behind the scenes.

Lex Li
  • 1,235
  • 8
  • 10