Open lukeyeager opened 9 months ago
We just recently added a scale
configuration option to the code. In theory, we could have an override that looks up the scale factor from another OID.
My workaround is not too bad. The downsides are that it moves some logic into prometheus' recording rules and that it adds a little too much data to the database that I don't really want.
generator.yml
modules:
entity-physical-sensors:
walk:
- entPhysicalIndex
- entPhysicalDescr
- entPhySensorScale
- entPhySensorPrecision
- entPhySensorValue
lookups:
- source_indexes: [entPhysicalIndex]
lookup: entPhysicalDescr
overrides:
entPhysicalIndex: {ignore: true}
entPhysicalDescr: {ignore: true}
prometheus/rules-recording.yml
groups:
- name: snmp-exporter
rules:
- record: entPhySensorValueScaled
expr: entPhySensorValue * 10 ^ (3 * (entPhySensorScale - 9) - entPhySensorPrecision)
@SuperQ yes, I noticed that new static field. But I would need something to handle the formula valueScaled = value * 10 ^ (3 * (scale - 9) - precision)
. You do a static scale, but I would need to be able to compose add, subtract, multiply, and pow. Which is a lot of new functionality. That, or add a special case for entPhySensorTable.
I'm content with a "no, that's out of scope." But I thought I'd ask just in case.
I think it's something we could do in code, but it would need to be generic enough to work with other MIBs.
I don't have time to implement this, but PRs would be welcome.
Host operating system: output of
uname -a
snmp_exporter version: output of
snmp_exporter -version
What device/snmpwalk OID are you using?
An Infiniband switch, using ENTITY-SENSOR-MIB (RFC 3433).
If this is a new device, please link to the MIB(s).
This is a standard MIB. You can download it using the Dockerfile below.
What did you do that produced an error?
No errors, but here is my setup.
generator.yml
Dockerfile
What did you expect to see?
The actual value for this sensor is 0.7. The user must combine scale, precision, and value to calculate this final value. In our custom exporter, we use the following snippet to do the conversion:
What did you see instead?
Currently, snmp-exporter can only report the individual values in separate series. Since this is a standard MIB, I was wondering if you might consider adding new functionality to
modules.NAME.overrides
(possibly a new "type"?) to handle this automatically.