snmp_exporter icon indicating copy to clipboard operation
snmp_exporter copied to clipboard

Feature: Textual Convention lookups for indexes

Open SuperQ opened this issue 4 years ago • 5 comments

The Raritan PDU2-MIB contains a TEXTUAL-CONVENTION enum used to identify sensor types. But the sensorType is not mapped into the table as a string, only as an index integer.

Example generator.yml:

modules:
  raritan:
   walk:
   - measurementsOutletSensorValue

Output snmp.yml:

# WARNING: This file was auto-generated using snmp_exporter generator, manual changes will be lost.
raritan:
  walk:
  - 1.3.6.1.4.1.13742.6.5.4.3.1.4
  metrics:
  - 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

It would be useful to be able to get the data for the sensorType SensorTypeEnumeration into the snmp.yml to replace gauge index with the string.

SuperQ avatar Oct 17 '19 12:10 SuperQ

+1 for this. I've hit the same issue with tFltrEntryStatFltrType part of the TIMETRA-FILTER-MIB.

tFltrEntryStatFltrType is enum that is only available as table index with enum values of: fltrtypeselIp (1), fltrtypeselMac (2), fltrtypeselIpv6 (4) and it would be great to get those as label values instead gauges.

tarko avatar Oct 26 '19 12:10 tarko

This is trickier than it seems code wise, as we currently only expose enums in the form of info/stateset and don't plumb that through elsewhere. A lookup won't cover it either, as they don't look at enum information either. We'd probably be looking at extending either lookups or indexes with enum values to support this.

For now I'd suggest using EnumAsInfo and group_left.

brian-brazil avatar Oct 30 '19 15:10 brian-brazil

Hmm, it looks like outletSensorMeasurementsTable has indexes which are not also objects within the table - which I've not seen before. I also note that the first index in that table is missing from the MIB. Do you have an example of what's in 1.3.6.1.4.1.13742.6.5.4.3.1.1?

brian-brazil avatar Dec 02 '19 12:12 brian-brazil

This is also a problem in the slightly more prominent ENTITY-SENSOR-MIB

elipsion avatar Jun 19 '23 12:06 elipsion

I found the same issue with Middle Atlantic PDU2-MIB. These are basically the same company, they just used a different enterprise number in the MIB. @brian-brazil it looks like you're right, the first index of outletSensorMeasurementsTable is missing (1.3.6.1.4.1.28679.18.5.4.3 in this case). I've attached the snmp-exporter output and also snmpwalk output for this table. Does this help answer your question?

metrics.txt snmpwalk.txt

If I understand this issue correctly, the idea is to return measurementsOutletSensorValue{outletId="1",pduId="1",sensorType="rmsVoltage"} 103 instead of measurementsOutletSensorValue{outletId="1",pduId="1",sensorType="4"} 103.

This would help, but I think it would be even nicer to rename it to outlet_rmsVoltage{outletId="1",pduId="1"} 103

llamafilm avatar Nov 29 '23 04:11 llamafilm