mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: Netbotz state sensors using wrong value (#7027)
* fix: Netbotz state sensors using wrong value * actual fix
This commit is contained in:
committed by
Tony Murray
parent
898f59cb72
commit
83cb39a7fd
@ -1043,14 +1043,14 @@ function can_skip_sensor($value, $data, $group)
|
||||
}
|
||||
}
|
||||
|
||||
$skip_values_lt = array_replace((array)$group['skip_value_lt'], (array)$data['skip_value_lt']);
|
||||
$skip_value_lt = array_replace((array)$group['skip_value_lt'], (array)$data['skip_value_lt']);
|
||||
foreach ($skip_value_lt as $skip_value) {
|
||||
if ($value < $skip_value) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$skip_values_gt = array_reduce((array)$group['skip_value_gt'], (array)$data['skip_value_gt']);
|
||||
$skip_value_gt = array_reduce((array)$group['skip_value_gt'], (array)$data['skip_value_gt']);
|
||||
foreach ($skip_value_gt as $skip_value) {
|
||||
if ($value > $skip_value) {
|
||||
return true;
|
||||
@ -1077,7 +1077,7 @@ function discovery_process(&$valid, $device, $sensor_type, $pre_cache)
|
||||
$tmp_name = $data['oid'];
|
||||
$raw_data = $pre_cache[$tmp_name];
|
||||
foreach ($raw_data as $index => $snmp_data) {
|
||||
$value = $snmp_data[$data['value']] ?: $snmp_data[$data['oid']];
|
||||
$value = is_numeric($snmp_data[$data['value']]) ? $snmp_data[$data['value']] : ($snmp_data[$data['oid']] ?: false);
|
||||
if (can_skip_sensor($value, $data, $sensor_options) === false && is_numeric($value)) {
|
||||
$oid = $data['num_oid'] . $index;
|
||||
if (isset($snmp_data[$data['descr']])) {
|
||||
@ -1085,8 +1085,8 @@ function discovery_process(&$valid, $device, $sensor_type, $pre_cache)
|
||||
} else {
|
||||
$descr = str_replace('{{ $index }}', $index, $data['descr']);
|
||||
}
|
||||
$divisor = $data['divisor'] ?: $sensor_options['divisor'] ?: 1;
|
||||
$multiplier = $data['multiplier'] ?: $sensor_options['multiplier'] ?: 1;
|
||||
$divisor = $data['divisor'] ?: ($sensor_options['divisor'] ?: 1);
|
||||
$multiplier = $data['multiplier'] ?: ($sensor_options['multiplier'] ?: 1);
|
||||
$low_limit = $data['low_limit'] ?: 'null';
|
||||
$low_warn_limit = $data['low_warn_limit'] ?: 'null';
|
||||
$warn_limit = $data['warn_limit'] ?: 'null';
|
||||
|
Reference in New Issue
Block a user