mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Allow num_oid to use OCTET STRING indexes (#10410)
* make index available as OCTET STRING converted to OID * codeclimate
This commit is contained in:
@@ -1047,6 +1047,9 @@ function discovery_process(&$valid, $device, $sensor_type, $pre_cache)
|
||||
$skippedFromYaml = YamlDiscovery::canSkipItem($value, $index, $data, $sensor_options, $pre_cache);
|
||||
if ($skippedFromYaml === false && is_numeric($value)) {
|
||||
$oid = str_replace('{{ $index }}', $index, $data['num_oid']);
|
||||
// if index is a string, we need to convert it to OID
|
||||
// strlen($index) as first number, and each letter converted to a number, separated by dots
|
||||
$oid = str_replace('{{ $index_string }}', strlen($index) . '.' . implode(".", unpack("c*", $index)), $oid);
|
||||
|
||||
// process the description
|
||||
$descr = YamlDiscovery::replaceValues('descr', $index, null, $data, $pre_cache);
|
||||
|
Reference in New Issue
Block a user