diff --git a/LibreNMS/Discovery/Yaml/YamlDiscoveryField.php b/LibreNMS/Discovery/Yaml/YamlDiscoveryField.php index 22fc9e66383daf27feefcf1580f4cdd555b844f9..be5825c747afff1a249caffb79288554b0c58077 100644 --- a/LibreNMS/Discovery/Yaml/YamlDiscoveryField.php +++ b/LibreNMS/Discovery/Yaml/YamlDiscoveryField.php @@ -86,6 +86,7 @@ class YamlDiscoveryField if ($this->key === 'value') { // only one oid $prefix = strstr($this->model_column, '_', true) ?: $this->model_column; + return [ 'num_oid', $prefix . '_oid', @@ -102,6 +103,7 @@ class YamlDiscoveryField { if (is_callable($this->callback)) { $this->value = call_user_func($this->callback, $value); + return; } diff --git a/LibreNMS/Modules/Processors.php b/LibreNMS/Modules/Processors.php index 28c5ba329fb19b85b58cb17ad0c53af112eff24b..a1e638ef154a54b872d0d78e67284b9a9ec0d04e 100644 --- a/LibreNMS/Modules/Processors.php +++ b/LibreNMS/Modules/Processors.php @@ -89,7 +89,7 @@ class Processors implements Module Log::info("$processor->processor_descr: $usage%"); $rrd_name = ['processor', $processor->processor_type, $processor->processor_index]; - $tags = ['processor_type' => $processor->processor_type, 'processor_index' => $processor->processor_index, 'rrd_name' => $rrd_name, 'rrd_def' => $rrd_def]; + $tags = ['processor_type' => $processor->processor_type, 'processor_index' => $processor->processor_index, 'rrd_name' => $rrd_name, 'rrd_def' => $rrd_def]; $fields = ['usage' => $usage]; $datastore->put($os->getDeviceArray(), 'processors', $tags, $fields); diff --git a/LibreNMS/OS/Boss.php b/LibreNMS/OS/Boss.php index 27e7d06e9447308ec6d9a072fa5a256f553a8bc4..765cc96229bc521129ed3925f53727c9b3546c6e 100644 --- a/LibreNMS/OS/Boss.php +++ b/LibreNMS/OS/Boss.php @@ -33,7 +33,6 @@ use App\Models\Device; use App\Models\PortVlan; use App\Models\Vlan; use Illuminate\Support\Collection; -use LibreNMS\Device\Processor; use LibreNMS\Interfaces\Discovery\OSDiscovery; use LibreNMS\Interfaces\Discovery\VlanDiscovery; use LibreNMS\Interfaces\Discovery\VlanPortDiscovery; diff --git a/LibreNMS/OS/Lcossx.php b/LibreNMS/OS/Lcossx.php index c69603e0cbcf2354d10cdbad594829ab674b14e7..fa6844a22925e822ac9146ebf9d3004473ae244f 100644 --- a/LibreNMS/OS/Lcossx.php +++ b/LibreNMS/OS/Lcossx.php @@ -95,7 +95,7 @@ class Lcossx extends OS implements ProcessorDiscovery, ProcessorPolling $cpuList = $this->convertProcessorData($data); foreach ($processors as $processor) { - $key = explode(' ',(string) $processor->processor_descr)[1]; + $key = explode(' ', (string) $processor->processor_descr)[1]; $processor->processor_usage = $cpuList[$key] ?? 0; } diff --git a/LibreNMS/OS/Traits/VxworksProcessorUsage.php b/LibreNMS/OS/Traits/VxworksProcessorUsage.php index 543209999147ed10776444981a1642cf498cb847..ea16593e72b45b444db48505a40bf0d70481c872 100644 --- a/LibreNMS/OS/Traits/VxworksProcessorUsage.php +++ b/LibreNMS/OS/Traits/VxworksProcessorUsage.php @@ -41,7 +41,7 @@ trait VxworksProcessorUsage */ public function discoverProcessors($oid = '.1.3.6.1.4.1.4413.1.1.1.1.4.9.0'): Collection { - $usage = SnmpQuery::get($oid)->value(); + $usage = SnmpQuery::get($oid)->value(); if ($usage) { $usage = $this->parseCpuUsageString($usage); if (is_numeric($usage)) { diff --git a/app/View/SimpleTemplate.php b/app/View/SimpleTemplate.php index 86095d0a2359f01b1bd3b9cd99680c8925f90ef6..e9f2e107c96d4eb6086cb8d804f4753b06dbf882 100644 --- a/app/View/SimpleTemplate.php +++ b/app/View/SimpleTemplate.php @@ -269,7 +269,7 @@ class SimpleTemplate implements \Stringable private function padFilter(string $value, array $args): string { - $direction = match($args[2] ?? 'left') { + $direction = match ($args[2] ?? 'left') { 'right' => STR_PAD_RIGHT, 'both' => STR_PAD_BOTH, default => STR_PAD_LEFT,