Werk #18762 · Aug 18, 26
ups_capacity: Fix crash on negative remaining battery time
This affects users monitoring UPS devices via SNMP whose device reports a
negative value for the remaining battery time (upsEstimatedMinutesRemaining,
OID .1.3.6.1.2.1.33.1.2.3.0). While that value is specified as non-negative,
some devices report a negative value when they cannot determine the remaining
time.
Previously the Battery capacity service crashed in this case with:
File ".../cmk/agent_based/v1/render.py", line 76, in _gen_timespan_chunks
raise ValueError("Cannot render negative timespan")
The service now goes UNKNOWN and reports the invalid value instead of crashing, for example:
Device reported an invalid remaining battery time (-60 seconds)
No battery_seconds_remaining metric is reported in this case. The battery
charge level and the time running on battery are not affected and are still
reported as before.
Details
- Class:
- Bug Fixes
- Level:
- Trivial
- Component:
- Checks
- Versions:
- 3.0.0b1Not yet releasedAll Editions
- 2.5.0p13All Editions
- 2.4.0p36All Editions