prometheus / snmp_exporter

SNMP Exporter for Prometheus
Apache License 2.0
1.66k stars 616 forks source link

Documentation/example on reversed ...<index>.<valuename> MIB #502

Open mhaebler opened 4 years ago

mhaebler commented 4 years ago

Having some generator issues with this Raritan PDU2-MIB.txt

Host operating system: output of uname -a

WSL2 Debian on Win10

$ uname -a
Linux PASWL-335609 4.4.0-18362-Microsoft #476-Microsoft Fri Nov 01 16:53:00 PST 2019 x86_64 GNU/Linux

snmp_exporter version: output of snmp_exporter -version

~/go/src/github.com/prometheus/snmp_exporter$ git show commit 57f01a99029ac95bbb27f84966db6294a4e02185 (HEAD -> master, origin/master, origin/HEAD)

What device/snmpwalk OID are you using?

Raritan PX3 - see MIB above. Here is the SNMP table I am trying to ingest:

$ snmpwalk -m mibs/PDU2-MIB.txt -c public-v2c  device 1.3.6.1.4.1.13742.6.5.4.3.1.4.1
PDU2-MIB::measurementsOutletSensorValue.1.1.rmsCurrent = Gauge32: 203
PDU2-MIB::measurementsOutletSensorValue.1.1.rmsVoltage = Gauge32: 120
PDU2-MIB::measurementsOutletSensorValue.1.1.activePower = Gauge32: 13
PDU2-MIB::measurementsOutletSensorValue.1.1.apparentPower = Gauge32: 24
PDU2-MIB::measurementsOutletSensorValue.1.1.powerFactor = Gauge32: 55
PDU2-MIB::measurementsOutletSensorValue.1.1.activeEnergy = Gauge32: 17111
PDU2-MIB::measurementsOutletSensorValue.1.1.onOff = Gauge32: 0
PDU2-MIB::measurementsOutletSensorValue.1.1.frequency = Gauge32: 600
PDU2-MIB::measurementsOutletSensorValue.1.2.rmsCurrent = Gauge32: 0
PDU2-MIB::measurementsOutletSensorValue.1.2.rmsVoltage = Gauge32: 120
PDU2-MIB::measurementsOutletSensorValue.1.2.activePower = Gauge32: 0
PDU2-MIB::measurementsOutletSensorValue.1.2.apparentPower = Gauge32: 0
PDU2-MIB::measurementsOutletSensorValue.1.2.powerFactor = Gauge32: 100
PDU2-MIB::measurementsOutletSensorValue.1.2.activeEnergy = Gauge32: 0
PDU2-MIB::measurementsOutletSensorValue.1.2.onOff = Gauge32: 0
PDU2-MIB::measurementsOutletSensorValue.1.2.frequency = Gauge32: 600
...

This goes against the usual examples I see in the example generator.yml where all MIBs seem to follow a <valuename>.<index> schema. Can someone provide an example how to handle the above?

Current generator.yml I tried:

modules:
  raritan:
    walk:
      - 1.3.6.1.4.1.13742.6.4.1.2.1.3  # outletOperationalState
      - 1.3.6.1.4.1.13742.6.5.4.3.1.4  # measurementsOutletSensorValue
    lookups:
      - source_indexes: [outletIndex]
        lookup: outletLabel
    overrides:
      outletOperationalState:
        type: EnumAsStateSet
    auth:
      community: public

This translates to snmp.yml as follows:

raritan:
  walk:
  - 1.3.6.1.4.1.13742.6.4.1.2.1.3
  - 1.3.6.1.4.1.13742.6.5.4.3.1.4
  metrics:
  - name: outletSwitchingState
    oid: 1.3.6.1.4.1.13742.6.4.1.2.1.3
    type: gauge
    help: The outlet state at present - 1.3.6.1.4.1.13742.6.4.1.2.1.3
    indexes:
    - labelname: pduId
      type: gauge
    - labelname: outletId
      type: gauge
    enum_values:
      -1: unavailable
      0: open
      1: closed
      2: belowLowerCritical
      3: belowLowerWarning
      4: normal
      5: aboveUpperWarning
      6: aboveUpperCritical
      7: "on"
      8: "off"
      9: detected
      10: notDetected
      11: alarmed
      12: ok
      14: fail
      15: "yes"
      16: "no"
      17: standby
      18: one
      19: two
      20: inSync
      21: outOfSync
      22: i1OpenFault
      23: i1ShortFault
      24: i2OpenFault
      25: i2ShortFault
      26: fault
      27: warning
      28: critical
      29: selfTest
      30: nonRedundant
  - name: measurementsOutletSensorValue
    oid: 1.3.6.1.4.1.13742.6.5.4.3.1.4
    type: gauge
    help: The sensor reading as an unsigned integer - 1.3.6.1.4.1.13742.6.5.4.3.1.4
    indexes:
    - labelname: pduId
      type: gauge
    - labelname: outletId
      type: gauge
    - labelname: sensorType
      type: gauge
  auth:
    community: public

If this is a new device, please link to the MIB(s).

Raritan PDU2-MIB.txt

What did you do that produced an error?

See generator.yml above. Does not produce any values for measurementsOutletSensorValue

What did you expect to see?

Values for everything in the MIB.

What did you see instead?

No values for measurementsOutletSensorValue. Are there any examples for how to handle this reversed order?

brian-brazil commented 4 years ago

That all looks normal to me. What's the problem?

mhaebler commented 4 years ago

@brian-brazil None of the measurementsOutletSensorValue related values show up in the snmp_exporter output.

brian-brazil commented 4 years ago

I'd break out tcpdump then, as that all looks fine to me.

tomkivlin commented 11 months ago

@mhaebler I understand the problem you've faced, but I've just tried the same using the same generator.yml as you shared above, and got the following in smtp.yaml

# WARNING: This file was auto-generated using snmp_exporter generator, manual changes will be lost.
auths:
  public_v1:
    community: public
    security_level: noAuthNoPriv
    auth_protocol: MD5
    priv_protocol: DES
    version: 1
  public_v2:
    community: public
    security_level: noAuthNoPriv
    auth_protocol: MD5
    priv_protocol: DES
    version: 2
modules:
  raritan:
    walk:
    - 1.3.6.1.4.1.13742.6.4.1.2.1.3
    - 1.3.6.1.4.1.13742.6.5.4.3.1.4
    metrics:
    - name: outletSwitchingState
      oid: 1.3.6.1.4.1.13742.6.4.1.2.1.3
      type: gauge
      help: The outlet state at present - 1.3.6.1.4.1.13742.6.4.1.2.1.3
      indexes:
      - labelname: pduId
        type: gauge
      - labelname: outletId
        type: gauge
      enum_values:
        -1: unavailable
        0: open
        1: closed
        2: belowLowerCritical
        3: belowLowerWarning
        4: normal
        5: aboveUpperWarning
        6: aboveUpperCritical
        7: "on"
        8: "off"
        9: detected
        10: notDetected
        11: alarmed
        12: ok
        14: fail
        15: "yes"
        16: "no"
        17: standby
        18: one
        19: two
        20: inSync
        21: outOfSync
        22: i1OpenFault
        23: i1ShortFault
        24: i2OpenFault
        25: i2ShortFault
        26: fault
        27: warning
        28: critical
        29: selfTest
        30: nonRedundant
    - name: measurementsOutletSensorValue
      oid: 1.3.6.1.4.1.13742.6.5.4.3.1.4
      type: gauge
      help: The sensor reading as an unsigned integer - 1.3.6.1.4.1.13742.6.5.4.3.1.4
      indexes:
      - labelname: pduId
        type: gauge
      - labelname: outletId
        type: gauge
      - labelname: sensorType
        type: gauge
        enum_values:
          1: rmsCurrent
          2: peakCurrent
          3: unbalancedCurrent
          4: rmsVoltage
          5: activePower
          6: apparentPower
          7: powerFactor
          8: activeEnergy
          9: apparentEnergy
          10: temperature
          11: humidity
          12: airFlow
          13: airPressure
          14: onOff
          15: trip
          16: vibration
          17: waterDetection
          18: smokeDetection
          19: binary
          20: contact
          21: fanSpeed
          22: surgeProtectorStatus
          23: frequency
          24: phaseAngle
          25: rmsVoltageLN
          26: residualCurrent
          27: rcmState
          28: absoluteHumidity
          29: reactivePower
          30: other
          31: none
          32: powerQuality
          33: overloadStatus
          34: overheatStatus
          35: displacementPowerFactor
          36: residualDcCurrent
          37: fanStatus
          38: inletPhaseSyncAngle
          39: inletPhaseSync
          40: operatingState
          41: activeInlet
          42: illuminance
          43: doorContact
          44: tamperDetection
          45: motionDetection
          46: i1smpsStatus
          47: i2smpsStatus
          48: switchStatus
          49: doorLockState
          50: doorHandleLock
          51: crestFactor
          52: length
          53: distance
          54: activePowerDemand
          55: residualAcCurrent
          56: particleDensity
          57: voltageThd
          58: currentThd
          59: inrushCurrent
          60: unbalancedVoltage
          61: unbalancedLineLineCurrent
          62: unbalancedLineLineVoltage

I've tried with two versions of the PDU2-MIB.txt both with similar results (the only difference being the 2017 version only has 50 enum_values for the measurementsOutletSensorValue.

raritan MODULE-IDENTITY
    LAST-UPDATED "202209210000Z"      -- September 21, 2022
raritan MODULE-IDENTITY
    LAST-UPDATED "201711130000Z"      -- November 13, 2017