mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
More Replacement Capabilities for sensor index computation (#14522)
* More Replacement Cap. style * more compact * fix mni.yaml * too compact, revert * quantastor * str_replace was never matched
This commit is contained in:
@@ -968,7 +968,15 @@ function discovery_process(&$valid, $os, $sensor_class, $pre_cache)
|
||||
$value = $user_function($value);
|
||||
}
|
||||
|
||||
$uindex = str_replace('{{ $index }}', $index, isset($data['index']) ? $data['index'] : $index);
|
||||
$uindex = $index;
|
||||
if (isset($data['index'])) {
|
||||
if (Str::contains($data['index'], '{{')) {
|
||||
$uindex = trim(YamlDiscovery::replaceValues('index', $index, null, $data, $pre_cache));
|
||||
} else {
|
||||
$uindex = $data['index'];
|
||||
}
|
||||
}
|
||||
|
||||
discover_sensor($valid['sensor'], $sensor_class, $device, $oid, $uindex, $sensor_name, $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $warn_limit, $high_limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured, $user_function, $group, $data['rrd_type']);
|
||||
|
||||
if ($sensor_class === 'state') {
|
||||
|
Reference in New Issue
Block a user