feature: Added support for entity values in sensors (#7805)

* Added info on using OIDs in skip_values for sensors

* added more docs + entity support

* remove whitespace
This commit is contained in:
Neil Lathwood
2017-12-02 22:56:57 +00:00
committed by GitHub
parent f1fa61758b
commit 5357dd9515
2 changed files with 20 additions and 4 deletions

View File

@@ -1037,6 +1037,9 @@ function discovery_process(&$valid, $device, $sensor_type, $pre_cache)
$warn_limit = is_numeric($data['warn_limit']) ? $data['warn_limit'] : dynamic_discovery_get_value('warn_limit', $index, $data, $pre_cache, 'null');
$high_limit = is_numeric($data['high_limit']) ? $data['high_limit'] : dynamic_discovery_get_value('high_limit', $index, $data, $pre_cache, 'null');
$entPhysicalIndex = str_replace('{{ $index }}', $index, $data['entPhysicalIndex']) ?: null;
$entPhysicalIndex_measured = isset($data['entPhysicalIndex_measured']) ? $data['entPhysicalIndex_measured'] : null;
$sensor_name = $device['os'];
if (isset($user_function) && function_exists($user_function)) {
@@ -1056,7 +1059,7 @@ function discovery_process(&$valid, $device, $sensor_type, $pre_cache)
}
$uindex = str_replace('{{ $index }}', $index, $data['index'] ?: $index);
discover_sensor($valid['sensor'], $sensor_type, $device, $oid, $uindex, $sensor_name, $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $warn_limit, $high_limit, $value, 'snmp', null, null, $user_function);
discover_sensor($valid['sensor'], $sensor_type, $device, $oid, $uindex, $sensor_name, $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $warn_limit, $high_limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured, $user_function);
if ($sensor_type === 'state') {
create_sensor_to_state_index($device, $sensor_name, $uindex);