Error discovering device - DivisionByZeroError: Division by zero php

Hello,

I’m not sure why my custom device has stopped begin discovered, this is all I see on one of them:

What log file is it referring to so I can troubleshoot?

This what a discovery of the device shows:

I see the error:

Sensor fetched value: 10
Error discovering sensors module for 10.100.30.208. DivisionByZeroError: Division by zero in /opt/librenms/includes/discovery/functions.inc.php:959

Line 959

Those divisor = 0 in those JSON arrays looks interesting? Perhaps that is ending up in your thing and giving you a Division by Zero ???

Humidity: Dynamic Discovery (humidity):  
array (
  'data' => 
  array (
    0 => 
    array (
      'oid' => 'rHumidity',
      'num_oid' => '.1.3.6.1.4.1.33762.7.7.2.{{ $index }}',
      'descr' => 'Humidity',
      'index' => 'rHumidity.{{ $index }}',
      'divisor' => 0,
      'low_limit' => 0,
      'warn_limit' => 15,
      'high_limit' => 30,
    ),
    1 => 
    array (
      'oid' => 'rwHumidityHyst',
      'num_oid' => '.1.3.6.1.4.1.33762.7.9.30.{{ $index }}',
      'descr' => 'Humidity Hysteresis',
      'index' => 'rwHumidityHyst.{{ $index }}',
      'divisor' => 0,
      'low_limit' => 0,
      'warn_limit' => 15,
      'high_limit' => 30,
    ),
  ),
)  

What could I change these to?

I fixed it - DivisionByZeroError: Division by zero in /opt/librenms/includes/discovery/functions.inc.php:959 · Issue #14877 · librenms/librenms · GitHub

Doesn’t this divisor value come from your modifications?

ie like in OS definition yaml working, how do I add custom OIDs? ?

I assume you either set it to 1 if you want the value, or something else if you need to ‘scale’ the value … (ie if the raw value is say 157 which equates to 15.7 degrees then set it to 10)

Im not sure, but I got a php expert to look at the functions.ini.php and he said it wasn’t right and set up to deal with a ‘0’ and helped with that.

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