Sensor Discovery in APC ATS

Hi,

I have an issue in APC ATS discovery.

After adding several APC ATS in LibreNMS, i had the following discovery error :


Current: APC PowerNet-MIB ATS Error discovering sensors module for xatsx. DivisionByZeroError: Division by zero in /opt/librenms/includes/discovery/sensors/current/apc.inc.php:203
Stack trace:
#0 /opt/librenms/includes/discovery/functions.inc.php(1007): include()
#1 /opt/librenms/includes/discovery/sensors.inc.php(84): sensors()
#2 /opt/librenms/includes/discovery/functions.inc.php(153): include(’…’)
#3 /opt/librenms/discovery.php(106): discover_device()
#4 {main}
Division by zero {“exception”:"[object] (DivisionByZeroError(code: 0): Division by zero at /opt/librenms/includes/discovery/sensors/current/apc.inc.php:203)"}

Looking at the file /opt/librenms/includes/discovery/sensors/current/apc.inc.php, line 203, i found a division by the variable “$precision” that is not declared.

After adding “$precision = ‘10’ ;”, few lines before, just after “$type = ‘apc’;”, it worked again.

Can you check and add this correction to the next update ?

Regards