snmp-ups 2.8.0: calibration OID is not re-polled after initial ASN.1 NULL response
Title: snmp-ups 2.8.0: calibration OID is not re-polled after initial ASN.1 NULL response
Environment
- Network UPS Tools 2.8.0,
snmp-ups1.21 - CyberPower SNMP MIB
- SNMPv1, isolated synthetic emulator
- Related but independent issue: #1427 (fixed by #1432)
Problem
When the calibration OID .1.3.6.1.4.1.3808.1.1.1.7.2.7.0 returns an ASN.1 NULL response during driver initialization, snmp-ups stops polling the OID.
If the response subsequently changes to INTEGER 3, the driver never reports the CAL status.
However, when INTEGER 3 is present from the beginning, the driver correctly reports OL CAL.
Steps to reproduce
- Start NUT 2.8.0
snmp-upsagainst a CyberPower-compatible SNMPv1 emulator. - Set the power-status OID to INTEGER 2 and calibration OID to ASN.1 NULL.
- Start the driver and verify that calibration is not reported.
- Change the calibration response to INTEGER 3 without restarting the driver.
- Observe that no additional GET requests are issued for calibration and
CALremains absent. - Restart the driver with calibration already returning INTEGER 3. The status now includes
CAL.
Analysis
Source inspection suggests that a failed INIT clears SU_FLAG_OK, preventing subsequent UPDATE polling for the affected mapping.
The same behavior was observed with both the original ADM-bundled NUT 2.8.0 driver and a locally corrected CyberPower MIB 0.52 candidate.
Therefore, this is not a regression introduced by the fix for #1427.
Expected behavior
An optional OID returning an unsupported ASN.1 type during initialization should not necessarily be disabled for the entire lifetime of the driver.
Could the maintainers review whether periodic retry or reinitialization is appropriate, and whether this behavior remains present in current NUT versions?
Testing limitations
The behavior was reproduced in an isolated emulator, not on physical hardware. The NULL-to-INTEGER transition has not been confirmed on the actual IPPON Innova TB 1000 management card.
No real UPS shutdown, AC-loss test or SNMP SET command was performed.
Additional observation
Under partial failure of the power-status OID, ups.status may become empty while other telemetry remains available with DATAOK. This appears to be a separate concern and is not proposed as part of the calibration fix.
Is this an AI(-augmented) post? Looks like one.
Some follow-up questions:
- Are there any actual devices seen to exhibit such transition (effectively, their firmware claiming an OID is not served and then serving it)?
- The optimization to not-query known mappings that are not served by a particular device is present in many subdrivers, it helps reduce polling time by not-doing useless work, and reduce load on the UPS NMCs which can get overwhelmed. Are there any reasons that CyberPower or CAL mapping were singled out?
- Apparently you (or your AI agent?) could analyze the old 2.8.0 code, why leave it to us to analyze the half a decade newer master branch, especially regarding what so far seems to be a synthetic FUD issue, until proven otherwise?
In any case, thanks for the post (especially if this proves to be a problem that bites in real life) :)
Hi Jim,
Thank you for taking the time to review the report and for your detailed questions.
Yes, the investigation and the report were AI-assisted. I used OpenAI Codex for source-code analysis, building isolated test environments, and examining the behavior of the NUT binaries. I am the NAS owner coordinating the investigation, rather than a NUT developer.
I think some additional background would help explain why we ended up investigating this particular behavior.
How this investigation started
The original problem had nothing to do with battery calibration.
We were investigating an ASUSTOR AS6804T running ADM 5.1.4.RM62, with an IPPON Innova TB 1000 UPS connected through a CyberPower-compatible SNMP management card.
Despite running a recent ADM 5 firmware, the NAS still ships with NUT 2.8.0, snmp-ups 1.21, and CyberPower MIB 0.51.
The UPS was reachable over SNMP, and the NAS could retrieve ordinary telemetry, including battery charge and estimated runtime. However, ups.status remained empty.
This was especially concerning because the NAS could not reliably distinguish normal AC operation from a power failure through its NUT status interface.
During the investigation, we discovered that this behavior matched the previously reported issue #1427, which had already been fixed upstream by PR #1432 back in 2022.
In other words, our starting point was a real compatibility problem caused by a relatively old NUT release still being distributed with a recent NAS firmware.
We have also reported this to ASUSTOR support (ticket #97942), requesting that the vendor incorporate the existing upstream correction.
Why we investigated the older driver
We initially attempted to backport the already-known CyberPower fix into the ASUSTOR environment.
Because rebuilding NUT against the vendor's library and SDK environment proved difficult, we also investigated a minimal binary-level correction of the existing driver.
We produced a narrowly scoped, 28-byte data-only modification and tested the resulting executable in an isolated environment. The correction restored the expected OL/OB status mapping in our synthetic tests.
During these tests, we examined not only the original defect but also the driver's behavior during initialization, status transitions, temporary SNMP failures, and recovery.
That is how we encountered several additional behaviors that appeared unusual or potentially problematic.
We understood that some of these might already have been addressed in newer NUT releases, which is another reason we wanted to bring the findings upstream rather than introduce additional modifications to the vendor driver.
The calibration observation
One particular test involved the calibration status OID:
.1.3.6.1.4.1.3808.1.1.1.7.2.7.0
We observed the following sequence in our SNMPv1 emulator:
- During initialization, the OID returns ASN.1 NULL.
- The driver does not obtain a usable calibration value and clears the mapping's
SU_FLAG_OK. - Later, the emulator changes the same OID to INTEGER 3, indicating calibration in progress.
- The running driver does not query that OID again, and
CALnever appears inups.status. - If the driver is restarted while INTEGER 3 is already present, it correctly reports
OL CAL.
This behavior was reproducible with both the original ASUSTOR NUT 2.8.0 binary and our locally corrected candidate.
We therefore do not believe it was introduced by our modification.
What struck us as unusual was the permanent loss of visibility into a possible calibration-state transition simply because the OID had returned NULL during initialization.
Real hardware versus synthetic testing
Your question about physical hardware is entirely justified.
We have not observed the NULL-to-INTEGER-3 transition on the actual IPPON management card.
In fact, we have not yet verified the full calibration OID behavior of that specific card.
However, I noticed that the original #1427 report already documents a real CyberPower PR1500LCD with an RMCARD205 returning ASN.1 NULL for this same calibration OID, alongside valid power and battery status OIDs.
So the initial NULL response is not necessarily an unrealistic SNMP scenario. What remains unverified is whether a real device can subsequently expose INTEGER 3 through the same OID without a driver restart.
We should have emphasized this distinction more clearly.
About the polling optimization
I understand your explanation that disabling unsupported OIDs is an intentional optimization, especially given the limited resources of some UPS network management cards.
We were not suggesting that all unsupported OIDs should be polled continuously or that CyberPower is uniquely affected.
CyberPower was simply the subdriver involved in our original real-world problem.
After your response, I also checked the current master sources. The general behavior of clearing SU_FLAG_OK after a failed initialization request and skipping disabled entries during subsequent update polling appears to remain present.
This suggests that the behavior we observed is consistent with the existing driver design, rather than necessarily being a defect specific to NUT 2.8.0.
A periodic retry, selective reinitialization, or other approach might be relevant only if actual hardware is shown to change the availability of such status OIDs.
Where we stand
At this point, I would distinguish two findings:
1. Confirmed real-world issue: The ASUSTOR-bundled NUT 2.8.0 still contains the old CyberPower OL/OB mapping problem already corrected upstream.
2. Reproducible laboratory observation: An initially unavailable calibration OID may remain permanently excluded from polling, preventing a later CAL transition from being detected.
The second finding is not yet a demonstrated real-world failure, and I agree it would be premature to request a driver change without additional evidence.
Our intention was to document what we found while investigating the older bundled driver, not to present a synthetic scenario as a confirmed hardware regression.
If you consider this expected behavior, I am happy to clarify the issue accordingly. We can also provide the isolated test scenario and relevant driver traces if they would be useful.
Thank you again for your feedback and for your work on Network UPS Tools. The project has been extremely useful in understanding how the NAS interacts with its UPS, and the upstream fixes have already helped us considerably.
Best regards, Alexey
Thanks for the clarifications. Regarding the fix you suggest, to retry the initially-NULL OIDs, I think the nearest equivalent is "semi-static" entry support (e.g. location/contacts) that are not likely to change often but also can change during a long driver uptime. So they are polled much less frequently than other values. A new strategy to occasionally retry NULLs instead of never retrying could be made similarly, I guess.