MegaTec NetAgent II AdPos PSU internal battery voltage wrong

I try to integrate 52 AdPos PSUs. All of them show the health sensor value for internal battery voltage as beeing off by the factor of 10 (beeing 2.2 V instead of 22V - see screenshot).

While checking
/opt/librenms/includes/discovery/sensors/voltage/netagent2.inc.php
I saw, the two OIDs for battery voltage (.1.3.6.1.4.1.935.1.1.1.2.2.2.0 for single phase units, .1.3.6.1.2.1.33.1.2.5.0 for three phase units ) already deliver the right value, but the outcome is unnecessarily put through the same divider as the voltage OIDs for input and output (where the division is actually necessary!).

Is this a bug or on purpose?

The RFC1628 says for the three phase unit OID ( .1.3.6.1.2.1.33.1.2.5.0 ) that “upsBatteryVoltage” is a “NonNegativeInteger” with “0.1 Volt DC” units. I guess, the device is missbehaving and delivering 1 Volt DC units - at least for the small PSUs that we are using. There ARE cases, where the internal voltage is actually around 300 volts, but we don’t manage PSUs that big, so I can’t test the OID output on these big fellas.

If I have to, I will, but I don’t want to locally hack the discovery script netagent2.inc.php. What would be the way to best differentiate between the two cases and get the right values?

Here#s the obligatory validate.php output. The fails/errors don’t have anything to do with the problem.

# ./validate.php 
====================================
Component | Version
--------- | -------
LibreNMS  | 1.55
DB Schema | 2019_07_09_150217_update_users_widgets_settings (140)
PHP       | 7.2.5
MySQL     | 10.2.25-MariaDB
RRDTool   | 1.7.0
SNMP      | NET-SNMP 5.7.3
====================================

[OK]    Composer Version: 1.9.0
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database schema correct
[FAIL]  The poller (<our-machine-name>) has not completed within the last 5 minutes, check the cron job.
[WARN]  Some devices have not been polled in the last 5 minutes. You may have performance issues.
	[FIX]: 
	Check your poll log and see: http://docs.librenms.org/Support/Performance/
	Devices:
	 <... list-of-device-names ...>
[FAIL]  fping6 location is incorrect or bin not installed.
	[FIX]: 
	Install fping6 or manually set the path to fping6 by placing the following in config.php: $config['fping6'] = '/path/to/fping6';
[WARN]  Your local git contains modified files, this could prevent automatic updates.
	[FIX]: 
	You can fix this with ./scripts/github-remove
	Modified Files:
	 html/.htaccess
	 html/images/librenms_logo.png
	 html/images/librenms_logo_blue.svg
	 html/images/librenms_logo_dark.svg
	 html/images/librenms_logo_light.svg
	 html/images/librenms_logo_mono.svg
[FAIL]  Some folders have incorrect file permissions, this may cause issues.
	[FIX]: 
	sudo chown -R librenms:librenms /opt/librenms
	sudo setfacl -d -m g::rwx /opt/librenms/rrd /var/log/librenms /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
	sudo chmod -R ug=rwX /opt/librenms/rrd /var/log/librenms /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
	Files:
	 /opt/librenms/storage/framework/cache/.gitignore

Workaround in the SQL of the alert rule for now:

SELECT * FROM devices,sensors WHERE (devices.device_id = ? AND devices.device_id = sensors.device_id) AND sensors.sensor_current < sensors.sensor_limit_low AND sensors.sensor_alert = 1 AND (devices.status = 1 && (devices.disabled = 0 && devices.ignore = 0)) = 1 AND (sensors.sensor_type != "netagent2" AND sensors.sensor_class != "voltage" AND sensors.sensor_descr != "Battery")

aka. “Not caring about that specific sensor, when it is a netagent2-device.”