Hi fellow prometheus-users, 

so I'm a bit stumped. I'm querying MIB tables that return OIDs as result 
value
(that can be referenced from a -DEFINES MIB), and I can't get snmp_exporter
to resolve these to textual representations. It does the usual magic 
conversion
of a non-numeric result to a label (setting the value to 1), storing the 
string
representation of the OIDs. Is there a way to get it to use the -DEFINES and
store the indirectly looked-up value behind the OID as label instead of the 
raw
OID? snmpbulkwalk does this, see below for details.

I've tried to extract the bare minimum set of things to replicate - this is
using Juniper kit as an example, but I'm fairly sure the concept of 
"foreign"
value indirection isn't exclusive to them. 

It's not unlikely that Juniper's MIBs are buggy (have seen that multiple 
times),
so this might well be a vendor problem.

so, my questions:

a) should snmp_exporter be able (assuming correct mibs) to do the indirect
resolution of OID constants/defines if they are returned as values?

b) if so, is that possible today, and what would I need to do?


------

# generator.yml (with a curated set of MIBDIRS, which is always identical 
for both generator and snmpcmd cli tools)
modules:
  foo:
    walk:
    - 1.3.6.1.4.1.2636.3.1.8.1.5

# generated snmp.yml:
# WARNING: This file was auto-generated using snmp_exporter generator, 
manual changes will be lost.
foo:
  walk:
  - 1.3.6.1.4.1.2636.3.1.8.1.5
  metrics:
  - name: jnxContentsType
    oid: 1.3.6.1.4.1.2636.3.1.8.1.5
    type: OctetString
    help: The type of this subject - 1.3.6.1.4.1.2636.3.1.8.1.5
    indexes:
    - labelname: jnxContentsContainerIndex
      type: gauge
    - labelname: jnxContentsL1Index
      type: gauge
    - labelname: jnxContentsL2Index
      type: gauge
    - labelname: jnxContentsL3Index
      type: gauge


# output from snmp_exporter when walking a lab device (let's call it 
192.0.2.2):
# HELP jnxContentsType The type of this subject - 1.3.6.1.4.1.2636.3.1.8.1.5
# TYPE jnxContentsType gauge
jnxContentsType{jnxContentsContainerIndex="1",jnxContentsL1Index="1",jnxContentsL2Index="0",jnxContentsL3Index="0",jnxContentsType="1.3.6.1.4.1.2636.1.1.2.1.63"}
 
1
jnxContentsType{jnxContentsContainerIndex="2",jnxContentsL1Index="1",jnxContentsL2Index="1",jnxContentsL3Index="0",jnxContentsType="1.3.6.1.4.1.2636.1.1.3.2.12.4"}
 
1
jnxContentsType{jnxContentsContainerIndex="4",jnxContentsL1Index="1",jnxContentsL2Index="1",jnxContentsL3Index="0",jnxContentsType="1.3.6.1.4.1.2636.1.1.3.2.12.5"}
 
1
jnxContentsType{jnxContentsContainerIndex="4",jnxContentsL1Index="1",jnxContentsL2Index="2",jnxContentsL3Index="0",jnxContentsType="1.3.6.1.4.1.2636.1.1.3.2.12.5"}
 
1
jnxContentsType{jnxContentsContainerIndex="7",jnxContentsL1Index="1",jnxContentsL2Index="0",jnxContentsL3Index="0",jnxContentsType="1.3.6.1.4.1.2636.1.1.3.2.12.1"}
 
1
jnxContentsType{jnxContentsContainerIndex="8",jnxContentsL1Index="1",jnxContentsL2Index="1",jnxContentsL3Index="0",jnxContentsType="1.3.6.1.4.1.2636.1.1.1.4.63.9"}
 
1
jnxContentsType{jnxContentsContainerIndex="8",jnxContentsL1Index="1",jnxContentsL2Index="2",jnxContentsL3Index="0",jnxContentsType="0.0"}
 
1
jnxContentsType{jnxContentsContainerIndex="9",jnxContentsL1Index="1",jnxContentsL2Index="0",jnxContentsL3Index="0",jnxContentsType="1.3.6.1.4.1.2636.1.1.3.2.12.3"}
 
1

# output from snmpbulkwalk using identical MIBDIRS as used for the 
generated config:
# snmpbulkwalk -OX -mALL -v2c -c public 192.0.2.2 
1.3.6.1.4.1.2636.3.1.8.1.5 
JUNIPER-MIB::jnxContentsType[1][1][0][0] = OID: 
JUNIPER-CHASSIS-DEFINES-MIB::jnxChassisEX4300
JUNIPER-MIB::jnxContentsType[2][1][1][0] = OID: 
JUNIPER-CHASSIS-DEFINES-MIB::jnxPower
JUNIPER-MIB::jnxContentsType[4][1][1][0] = OID: 
JUNIPER-CHASSIS-DEFINES-MIB::jnxFan
JUNIPER-MIB::jnxContentsType[4][1][2][0] = OID: 
JUNIPER-CHASSIS-DEFINES-MIB::jnxFan
JUNIPER-MIB::jnxContentsType[7][1][0][0] = OID: 
JUNIPER-CHASSIS-DEFINES-MIB::jnxFPC
JUNIPER-MIB::jnxContentsType[8][1][1][0] = OID: 
JUNIPER-CHASSIS-DEFINES-MIB::jnxProductEX4300port48MP
JUNIPER-MIB::jnxContentsType[8][1][2][0] = OID: DLSW-MIB::null
JUNIPER-MIB::jnxContentsType[9][1][0][0] = OID: 
JUNIPER-CHASSIS-DEFINES-MIB::jnxHM

# snmptranslate unsurprisingly works with the returned value oids:
# snmptranslate -mALL 1.3.6.1.4.1.2636.1.1.3.2.12.4 2>/dev/null
JUNIPER-CHASSIS-DEFINES-MIB::jnxPower


Kind regards

Felix

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/568c6e03-7856-46d4-9f78-6ad73066a6fen%40googlegroups.com.

Reply via email to