mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Update functions.inc.php
- Add extra safety check
This commit is contained in:
@@ -18,7 +18,9 @@ function poll_sensor($device, $class, $unit)
|
||||
if ($debug) echo("Attempt $i ");
|
||||
$sensor_value = trim(str_replace("\"", "", snmp_get($device, $sensor['sensor_oid'], "-OUqnv", "SNMPv2-MIB")));
|
||||
preg_match("/[\d\.]+/",$sensor_value,$temp_response);
|
||||
$sensor_value = $temp_response[0];
|
||||
if (!empty($temp_response[0])) {
|
||||
$sensor_value = $temp_response[0];
|
||||
}
|
||||
|
||||
if (is_numeric($sensor_value) && $sensor_value != 9999) break; # TME sometimes sends 999.9 when it is right in the middle of an update;
|
||||
sleep(1); # Give the TME some time to reset
|
||||
|
Reference in New Issue
Block a user