Werk #18762: ups_capacity: Fix crash on negative remaining battery time
| Component | Checks & agents | ||||||
| Title | ups_capacity: Fix crash on negative remaining battery time | ||||||
| Date | Aug 18, 2026 | ||||||
| Level | Trivial Change | ||||||
| Class | Bug Fix | ||||||
| Compatibility | Compatible - no manual interaction needed | ||||||
| Checkmk versions & editions |
|
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.