DivisionByZeroError entity-sensor.inc.php SensorScale "zepto" missing

$ ./validate.php

Component Version
LibreNMS 23.2.0-31-g68e0b3df2 (2023-03-13T22:32:22+01:00)
DB Schema 2022_08_15_084507_add_rrd_type_to_wireless_sensors_table (248)
PHP 8.1.11
Python 3.9.15
Database MariaDB 10.5.15-MariaDB
RRDTool 1.8.0
SNMP 5.9.1
===========================================

[OK] Composer Version: 2.5.4
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database Schema is current
[OK] SQL Server meets minimum requirements
[OK] lower_case_table_names is enabled
[OK] MySQL engine is optimal
[OK] Database and column collations are correct
[OK] Database schema correct
[OK] MySQl and PHP time match
[OK] Distributed Polling setting is enabled globally
[OK] Connection to memcached is ok
[OK] Connected to rrdcached
[OK] Active pollers found
[OK] Dispatcher Service not detected
[OK] Locks are functional
[OK] Python poller wrapper is polling
[OK] Redis is unavailable
[WARN] IPv6 is disabled on your server, you will not be able to add IPv6 devices.
[OK] rrdtool version ok
[OK] Connected to rrdcached

SQL[SELECT COUNT(*) FROM sensors WHERE device_id = ? AND sensor_class = ? AND sensor_type = ‘cisco-entity-sensor’ AND sensor_index = ? [24104,“voltage”,25003] 0.83ms]

SQL[SELECT COUNT(*) FROM sensors WHERE device_id = ? AND sensor_class = ? AND sensor_type = ‘cisco-entity-sensor’ AND sensor_index = ? [24104,“voltage”,25004] 0.81ms]

SQL[SELECT COUNT(*) FROM sensors WHERE device_id = ? AND sensor_class = ? AND sensor_type = ‘cisco-entity-sensor’ AND sensor_index = ? [24104,“voltage”,25005] 0.81ms]

SQL[SELECT COUNT(*) FROM sensors WHERE device_id = ? AND sensor_class = ? AND sensor_type = ‘cisco-entity-sensor’ AND sensor_index = ? [24104,“voltage”,25006] 0.8ms]

Error discovering sensors module for ******. DivisionByZeroError: Division by zero in /usr/opt/librenms/includes/discovery/sensors/entity-sensor.inc.php:140
Stack trace:
#0 /usr/opt/librenms/includes/discovery/sensors.inc.php(16): require()
#1 /usr/opt/librenms/includes/discovery/functions.inc.php(153): include(‘/usr/opt/libren…’)
#2 /usr/opt/librenms/discovery.php(106): discover_device(Array, true)
#3 {main}
SQL[insert into eventlog (reference, type, datetime, severity, message, username, device_id) values (?, ?, ?, ?, ?, ?, ?) [null,“discovery”,“2023-03-14 09:56:43”,5,“Error discovering sensors module. Check log file for more details.”,“”,24104] 0.48ms]

Division by zero {“exception”:“[object] (DivisionByZeroError(code: 0): Division by zero at /usr/opt/librenms/includes/discovery/sensors/entity-sensor.inc.php:140)”}

// LOG //

[2023-03-14T09:56:43.166646+01:00] production.ERROR: Error discovering sensors module for ******. DivisionByZeroError: Division by zero in /usr/opt/librenms/includes/discovery/sensors/entity-sensor.inc.php:140
Stack trace:
#0 /usr/opt/librenms/includes/discovery/sensors.inc.php(16): require()
#1 /usr/opt/librenms/includes/discovery/functions.inc.php(153): include(‘/usr/opt/libren…’)
#2 /usr/opt/librenms/discovery.php(106): discover_device(Array, true)
#3 {main}
[2023-03-14T09:56:43.171221+01:00] production.ERROR: Division by zero {“exception”:“[object] (DivisionByZeroError(code: 0): Division by zero at /usr/opt/librenms/includes/discovery/sensors/entity-sensor.inc.php:140)”}

objectID 25003 to 25006 ok!
25007 fails…

snmpwalk:

entPhySensorType.25003 = voltsDC
entPhySensorType.25004 = voltsDC
entPhySensorType.25005 = voltsDC
entPhySensorType.25006 = voltsDC
entPhySensorType.25007 = voltsDC

entSensorValue.25003 = 4984
entSensorValue.25004 = 3288
entSensorValue.25005 = 1794
entSensorValue.25006 = 12045
entSensorValue.25007 = 4959

entPhySensorScale.25003 = yocto
entPhySensorScale.25004 = yocto
entPhySensorScale.25005 = yocto
entPhySensorScale.25006 = yocto
entPhySensorScale.25007 = zepto

25003 =>
array (
‘entSensorType’ => ‘voltsDC’,
‘entSensorScale’ => ‘yocto’,
‘entSensorValue’ => ‘4984’,
‘entSensorMeasuredEntity’ => ‘25000’,
‘entSensorPrecision’ => ‘0’,
),
25004 =>
array (
‘entSensorType’ => ‘voltsDC’,
‘entSensorScale’ => ‘yocto’,
‘entSensorValue’ => ‘3288’,
‘entSensorMeasuredEntity’ => ‘25000’,
‘entSensorPrecision’ => ‘0’,
),
25005 =>
array (
‘entSensorType’ => ‘voltsDC’,
‘entSensorScale’ => ‘yocto’,
‘entSensorValue’ => ‘1794’,
‘entSensorMeasuredEntity’ => ‘25000’,
‘entSensorPrecision’ => ‘0’,
),
25006 =>
array (
‘entSensorType’ => ‘voltsDC’,
‘entSensorScale’ => ‘yocto’,
‘entSensorValue’ => ‘12045’,
‘entSensorMeasuredEntity’ => ‘25000’,
‘entSensorPrecision’ => ‘0’,
),
25007 =>
array (
‘entSensorType’ => ‘voltsDC’,
‘entSensorScale’ => ‘zepto’,
‘entSensorValue’ => ‘4959’,
‘entSensorMeasuredEntity’ => ‘25000’,
‘entSensorPrecision’ => ‘0’,
),

→ /usr/opt/librenms/includes/discovery/sensors/entity-sensor.inc.php

            $type = $entitysensor[$entry['entPhySensorType']];
            // FIXME this stuff is foul
            if ($entry['entPhySensorScale'] == 'nano') {
                $divisor = '1000000000';
                $multiplier = '1';
            }
            if ($entry['entPhySensorScale'] == 'micro') {
                $divisor = '1000000';
                $multiplier = '1';
            }
            if ($entry['entPhySensorScale'] == 'milli') {
                $divisor = '1000';
                $multiplier = '1';
            }
            if ($entry['entPhySensorScale'] == 'units') {
                $divisor = '1';
                $multiplier = '1';
            }
            if ($entry['entPhySensorScale'] == 'kilo') {
                $divisor = '1';
                $multiplier = '1000';
            }
            if ($entry['entPhySensorScale'] == 'mega') {
                $divisor = '1';
                $multiplier = '1000000';
            }
            if ($entry['entPhySensorScale'] == 'giga') {
                $divisor = '1';
                $multiplier = '1000000000';
            }
            if ($entry['entPhySensorScale'] == 'yocto') {
                $divisor = '1';
                $multiplier = '1';
            }

zepto is missing!

damn… the next one…
from a new Cisco IOS-XE Cablerouter Device

SQL[SELECT COUNT(*) FROM sensors WHERE device_id = ? AND sensor_class = ? AND sensor_type = ‘cisco-entity-sensor’ AND sensor_index = ? [24113,“temperature”,25002] 0.43ms]

SQL[SELECT COUNT(*) FROM sensors WHERE device_id = ? AND sensor_class = ? AND sensor_type = ‘cisco-entity-sensor’ AND sensor_index = ? [24113,“voltage”,25003] 0.43ms]

Error discovering sensors module for ******. DivisionByZeroError: Division by zero in /usr/opt/librenms/includes/discovery/sensors/entity-sensor.inc.php:144
Stack trace:
#0 /usr/opt/librenms/includes/discovery/sensors.inc.php(16): require()
#1 /usr/opt/librenms/includes/discovery/functions.inc.php(153): include(‘/usr/opt/libren…’)
#2 /usr/opt/librenms/discovery.php(106): discover_device(Array, true)
#3 {main}

'entSensorType' => 'voltsDC',

entPhySensorScale.25003 = yocto
entPhySensorScale.25004 = atto
entPhySensorScale.25005 = yocto
entPhySensorScale.25006 = yocto
entPhySensorScale.25007 = zepto
entPhySensorScale.25008 = yocto
entPhySensorScale.25009 = yocto

entSensorScale.85003 = atto
entSensorScale.85004 = yocto
entSensorScale.85005 = nano
entSensorScale.85006 = yocto
entSensorScale.85007 = yocto
entSensorScale.85008 = femto
entSensorScale.85009 = yocto

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.