snmp_exporter icon indicating copy to clipboard operation
snmp_exporter copied to clipboard

Exporter is treating "String64" syntax as "octetstring" instead of "displayString"

Open larsks opened this issue 10 months ago • 5 comments

I'm using snmp_exporter to gather metrics from some Dell iDRAC devices. I noticed that string values were all showing up as hex strings (see the systemBIOSManufacturerName label, below):

systemBIOSManufacturerName{instance="10.2.11.112", job="idrac_snmp", systemBIOSIndex="1", systemBIOSManufacturerName="0x44656C6C20496E632E", systemBIOSchassisIndex="1"}	

These OIDs are delcared as String64 in the MIB:

systemBIOSManufacturerName                      OBJECT-TYPE
    SYNTAX      String64
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
        "0300.0050.0001.0011 This attribute defines the name of the manufacturer
        of the system BIOS."
    ::= { systemBIOSTableEntry 11 }

snmpwalk displays them like this:

$ snmpwalk -M mibs -m ALL -v2c -c public 10.2.11.132 IDRAC-MIB-SMIv2::systemBIOSManufacturerName
IDRAC-MIB-SMIv2::systemBIOSManufacturerName.1.1 = STRING: "Dell Inc."

Is the problem that snmp_exporter doesn't know about the String64 syntax? Evidence suggests that this is a Dell-ism. Is there a way to declare this an alias for displayString? It's going to be messy if I need to override all of these individually.

larsks avatar Mar 07 '25 17:03 larsks

Yes, it seems like the exporter doesn't understand String64 textual convention.

SuperQ avatar Mar 07 '25 17:03 SuperQ

It seems like the Dell MIB defines it this way:

String64                ::= TEXTUAL-CONVENTION
    STATUS current
    DESCRIPTION
        "General string type for 64 byte strings."
    SYNTAX              OCTET STRING (SIZE (0..64))

So, it does say it's a octet string, which isn't a DisplayString. So this appears to be a mistake on the Dell MIB side.

You can override it like this:

  dell:
    walk:
      - 1.3.6.1.4.1.674.10892.5.2 # statusGroup
      - 1.3.6.1.4.1.674.10892.5.4 # systemDetailsGroup
      - 1.3.6.1.4.1.674.10892.5.5 # storageDetailsGroup
    overrides:
      systemBIOSManufacturerName:
        type: DisplayString

SuperQ avatar Mar 07 '25 17:03 SuperQ

You can override it like this:

Right, but as I said in my earlier comment:

It's going to be messy if I need to override all of these individually.

Because there are about 138 values. Sure, I probably don't need all of them. I was hoping for a way to override things based on a pattern, like:

overrides:
  '.*Name':
    type: DisplayString

Or better yet to declare a type alias. I know that's not supported right now; maybe the syntax would look something like:

syntaxAlias:
  String64:
    type: DisplayString

For now, I've just patched the MIB to replace all instance of String64 with DisplayString (SIZE (1..64)), which I think is probably the intent. Seems to work, although patching MIBs is a messy solution.

larsks avatar Mar 07 '25 17:03 larsks

A syntax override configuration is an interesting feature idea.

SuperQ avatar Mar 07 '25 17:03 SuperQ

The Dell MIBs are even more annoying, because String64 isn't the only weird string type. We also have:

  • DateName (declared as an OCTET STRING)
  • StringType (declared as an OCTET STRING)

...and I'm sure I'm going to discover others.

larsks avatar Mar 08 '25 04:03 larsks