From a0ba412d6c68483ac8a49230f6c644a2d94ba79d Mon Sep 17 00:00:00 2001 From: rdezavalia Date: Thu, 29 Aug 2019 19:11:23 -0300 Subject: [PATCH] Added more DELL switches in order to get proper CPU stats (#10529) * Added more DELL switches in order to get proper CPU stats More DELL switches supported: * N4032 * N2048 * N2024 * N3048 * N2048P * 54XX * fixed indent as requested by phpcbf * fixed multiline argument function call * removed blank lines * Added CPU stats for N4064F * Added test data for N4064F * fixed indent as requested by phpcbf * Added test data for Dell Powerconnect 5424 * Added test data for Dell Powerconnect 5448 * Added test data for Dell Powerconnect 5524 * Added test data for Dell Powerconnect N4032 * Added test data for Dell Powerconnect N2024 * Added test data for Dell Powerconnect N2048 * Added test data for Dell Powerconnect N2048P * Added test data for Dell Powerconnect N3048 * Fixed processor usage data * Fixed snmpsim data for 3056 * Fixed processor usage * easier to read format * remove space changes * 3056 should be 8% --- LibreNMS/OS/Powerconnect.php | 20 ++++++++++++++++---- tests/data/powerconnect_3020.json | 20 ++++++++++++++++++++ tests/data/powerconnect_3021.json | 20 ++++++++++++++++++++ tests/data/powerconnect_3030.json | 20 ++++++++++++++++++++ tests/data/powerconnect_3042.json | 20 ++++++++++++++++++++ tests/data/powerconnect_3046.json | 20 ++++++++++++++++++++ tests/data/powerconnect_3053.json | 20 ++++++++++++++++++++ tests/data/powerconnect_3054.json | 20 ++++++++++++++++++++ tests/data/powerconnect_3056.json | 20 ++++++++++++++++++++ tests/data/powerconnect_3058.json | 20 ++++++++++++++++++++ tests/snmpsim/powerconnect_3020.snmprec | 3 +++ tests/snmpsim/powerconnect_3021.snmprec | 3 +++ tests/snmpsim/powerconnect_3030.snmprec | 3 +++ tests/snmpsim/powerconnect_3042.snmprec | 3 +++ tests/snmpsim/powerconnect_3046.snmprec | 3 +++ tests/snmpsim/powerconnect_3053.snmprec | 3 +++ tests/snmpsim/powerconnect_3054.snmprec | 3 +++ tests/snmpsim/powerconnect_3056.snmprec | 3 +++ tests/snmpsim/powerconnect_3058.snmprec | 3 +++ 19 files changed, 223 insertions(+), 4 deletions(-) create mode 100644 tests/data/powerconnect_3020.json create mode 100644 tests/data/powerconnect_3021.json create mode 100644 tests/data/powerconnect_3030.json create mode 100644 tests/data/powerconnect_3042.json create mode 100644 tests/data/powerconnect_3046.json create mode 100644 tests/data/powerconnect_3053.json create mode 100644 tests/data/powerconnect_3054.json create mode 100644 tests/data/powerconnect_3056.json create mode 100644 tests/data/powerconnect_3058.json create mode 100644 tests/snmpsim/powerconnect_3020.snmprec create mode 100644 tests/snmpsim/powerconnect_3021.snmprec create mode 100644 tests/snmpsim/powerconnect_3030.snmprec create mode 100644 tests/snmpsim/powerconnect_3042.snmprec create mode 100644 tests/snmpsim/powerconnect_3046.snmprec create mode 100644 tests/snmpsim/powerconnect_3053.snmprec create mode 100644 tests/snmpsim/powerconnect_3054.snmprec create mode 100644 tests/snmpsim/powerconnect_3056.snmprec create mode 100644 tests/snmpsim/powerconnect_3058.snmprec diff --git a/LibreNMS/OS/Powerconnect.php b/LibreNMS/OS/Powerconnect.php index 8b58b7e3f9..20d0f4534b 100644 --- a/LibreNMS/OS/Powerconnect.php +++ b/LibreNMS/OS/Powerconnect.php @@ -48,8 +48,12 @@ class Powerconnect extends OS implements ProcessorDiscovery, ProcessorPolling public function discoverProcessors() { $device = $this->getDevice(); - - if (starts_with($device['sysObjectID'], '.1.3.6.1.4.1.674.10895.3031')) { + if (starts_with($device['sysObjectID'], [ + '.1.3.6.1.4.1.674.10895.3020', + '.1.3.6.1.4.1.674.10895.3021', + '.1.3.6.1.4.1.674.10895.3030', + '.1.3.6.1.4.1.674.10895.3031', + ])) { d_echo("Dell Powerconnect 55xx"); return array( Processor::discover( @@ -59,10 +63,18 @@ class Powerconnect extends OS implements ProcessorDiscovery, ProcessorPolling 0 ) ); - } elseif (starts_with($device['sysObjectID'], ['.1.3.6.1.4.1.674.10895.3024', '.1.3.6.1.4.1.674.10895.3065'])) { + } elseif (starts_with($device['sysObjectID'], [ + '.1.3.6.1.4.1.674.10895.3024', + '.1.3.6.1.4.1.674.10895.3042', + '.1.3.6.1.4.1.674.10895.3053', + '.1.3.6.1.4.1.674.10895.3054', + '.1.3.6.1.4.1.674.10895.3056', + '.1.3.6.1.4.1.674.10895.3058', + '.1.3.6.1.4.1.674.10895.3065', + '.1.3.6.1.4.1.674.10895.3046', + ])) { return $this->discoverVxworksProcessors('.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.9.0'); } - return $this->discoverVxworksProcessors('.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.4.0'); } diff --git a/tests/data/powerconnect_3020.json b/tests/data/powerconnect_3020.json new file mode 100644 index 0000000000..cf194ff64c --- /dev/null +++ b/tests/data/powerconnect_3020.json @@ -0,0 +1,20 @@ +{ + "processors": { + "discovery": { + "processors": [ + { + "entPhysicalIndex": "0", + "hrDeviceIndex": "0", + "processor_oid": ".1.3.6.1.4.1.89.1.7.0", + "processor_index": "0", + "processor_type": "powerconnect-nv", + "processor_usage": "96", + "processor_descr": "Processor", + "processor_precision": "1", + "processor_perc_warn": "75" + } + ] + }, + "poller": "matches discovery" + } +} diff --git a/tests/data/powerconnect_3021.json b/tests/data/powerconnect_3021.json new file mode 100644 index 0000000000..70ecd9d080 --- /dev/null +++ b/tests/data/powerconnect_3021.json @@ -0,0 +1,20 @@ +{ + "processors": { + "discovery": { + "processors": [ + { + "entPhysicalIndex": "0", + "hrDeviceIndex": "0", + "processor_oid": ".1.3.6.1.4.1.89.1.7.0", + "processor_index": "0", + "processor_type": "powerconnect-nv", + "processor_usage": "91", + "processor_descr": "Processor", + "processor_precision": "1", + "processor_perc_warn": "75" + } + ] + }, + "poller": "matches discovery" + } +} diff --git a/tests/data/powerconnect_3030.json b/tests/data/powerconnect_3030.json new file mode 100644 index 0000000000..e8c8151da6 --- /dev/null +++ b/tests/data/powerconnect_3030.json @@ -0,0 +1,20 @@ +{ + "processors": { + "discovery": { + "processors": [ + { + "entPhysicalIndex": "0", + "hrDeviceIndex": "0", + "processor_oid": ".1.3.6.1.4.1.89.1.7.0", + "processor_index": "0", + "processor_type": "powerconnect-nv", + "processor_usage": "89", + "processor_descr": "Processor", + "processor_precision": "1", + "processor_perc_warn": "75" + } + ] + }, + "poller": "matches discovery" + } +} diff --git a/tests/data/powerconnect_3042.json b/tests/data/powerconnect_3042.json new file mode 100644 index 0000000000..63abec6a63 --- /dev/null +++ b/tests/data/powerconnect_3042.json @@ -0,0 +1,20 @@ +{ + "processors": { + "discovery": { + "processors": [ + { + "entPhysicalIndex": "0", + "hrDeviceIndex": "0", + "processor_oid": ".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.9.0", + "processor_index": "0", + "processor_type": "powerconnect", + "processor_usage": "16", + "processor_descr": "Processor", + "processor_precision": "1", + "processor_perc_warn": "75" + } + ] + }, + "poller": "matches discovery" + } +} diff --git a/tests/data/powerconnect_3046.json b/tests/data/powerconnect_3046.json new file mode 100644 index 0000000000..c6e3d47473 --- /dev/null +++ b/tests/data/powerconnect_3046.json @@ -0,0 +1,20 @@ +{ + "processors": { + "discovery": { + "processors": [ + { + "entPhysicalIndex": "0", + "hrDeviceIndex": "0", + "processor_oid": ".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.9.0", + "processor_index": "0", + "processor_type": "powerconnect", + "processor_usage": "19", + "processor_descr": "Processor", + "processor_precision": "1", + "processor_perc_warn": "75" + } + ] + }, + "poller": "matches discovery" + } +} diff --git a/tests/data/powerconnect_3053.json b/tests/data/powerconnect_3053.json new file mode 100644 index 0000000000..63abec6a63 --- /dev/null +++ b/tests/data/powerconnect_3053.json @@ -0,0 +1,20 @@ +{ + "processors": { + "discovery": { + "processors": [ + { + "entPhysicalIndex": "0", + "hrDeviceIndex": "0", + "processor_oid": ".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.9.0", + "processor_index": "0", + "processor_type": "powerconnect", + "processor_usage": "16", + "processor_descr": "Processor", + "processor_precision": "1", + "processor_perc_warn": "75" + } + ] + }, + "poller": "matches discovery" + } +} diff --git a/tests/data/powerconnect_3054.json b/tests/data/powerconnect_3054.json new file mode 100644 index 0000000000..c6e3d47473 --- /dev/null +++ b/tests/data/powerconnect_3054.json @@ -0,0 +1,20 @@ +{ + "processors": { + "discovery": { + "processors": [ + { + "entPhysicalIndex": "0", + "hrDeviceIndex": "0", + "processor_oid": ".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.9.0", + "processor_index": "0", + "processor_type": "powerconnect", + "processor_usage": "19", + "processor_descr": "Processor", + "processor_precision": "1", + "processor_perc_warn": "75" + } + ] + }, + "poller": "matches discovery" + } +} diff --git a/tests/data/powerconnect_3056.json b/tests/data/powerconnect_3056.json new file mode 100644 index 0000000000..8ce3cd068d --- /dev/null +++ b/tests/data/powerconnect_3056.json @@ -0,0 +1,20 @@ +{ + "processors": { + "discovery": { + "processors": [ + { + "entPhysicalIndex": "0", + "hrDeviceIndex": "0", + "processor_oid": ".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.9.0", + "processor_index": "0", + "processor_type": "powerconnect", + "processor_usage": "8", + "processor_descr": "Processor", + "processor_precision": "1", + "processor_perc_warn": "75" + } + ] + }, + "poller": "matches discovery" + } +} diff --git a/tests/data/powerconnect_3058.json b/tests/data/powerconnect_3058.json new file mode 100644 index 0000000000..9b23528f25 --- /dev/null +++ b/tests/data/powerconnect_3058.json @@ -0,0 +1,20 @@ +{ + "processors": { + "discovery": { + "processors": [ + { + "entPhysicalIndex": "0", + "hrDeviceIndex": "0", + "processor_oid": ".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.9.0", + "processor_index": "0", + "processor_type": "powerconnect", + "processor_usage": "33", + "processor_descr": "Processor", + "processor_precision": "1", + "processor_perc_warn": "75" + } + ] + }, + "poller": "matches discovery" + } +} diff --git a/tests/snmpsim/powerconnect_3020.snmprec b/tests/snmpsim/powerconnect_3020.snmprec new file mode 100644 index 0000000000..6aadb6c256 --- /dev/null +++ b/tests/snmpsim/powerconnect_3020.snmprec @@ -0,0 +1,3 @@ +1.3.6.1.2.1.1.1.0|4|PowerConnect 5424 +1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.674.10895.3020 +1.3.6.1.4.1.89.1.7.0|2|96 diff --git a/tests/snmpsim/powerconnect_3021.snmprec b/tests/snmpsim/powerconnect_3021.snmprec new file mode 100644 index 0000000000..7c1481bf35 --- /dev/null +++ b/tests/snmpsim/powerconnect_3021.snmprec @@ -0,0 +1,3 @@ +1.3.6.1.2.1.1.1.0|4|PowerConnect 5448 +1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.674.10895.3021 +1.3.6.1.4.1.89.1.7.0|2|91 diff --git a/tests/snmpsim/powerconnect_3030.snmprec b/tests/snmpsim/powerconnect_3030.snmprec new file mode 100644 index 0000000000..65d52bab64 --- /dev/null +++ b/tests/snmpsim/powerconnect_3030.snmprec @@ -0,0 +1,3 @@ +1.3.6.1.2.1.1.1.0|4|24G Ethernet Switch +1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.674.10895.3030 +1.3.6.1.4.1.89.1.7.0|2|89 diff --git a/tests/snmpsim/powerconnect_3042.snmprec b/tests/snmpsim/powerconnect_3042.snmprec new file mode 100644 index 0000000000..82d1d20356 --- /dev/null +++ b/tests/snmpsim/powerconnect_3042.snmprec @@ -0,0 +1,3 @@ +1.3.6.1.2.1.1.1.0|4|Dell Networking N4032, 6.3.2.4, Linux 3.7.10-20383c08 +1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.674.10895.3042 +1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.9.0|4|5 Secs ( 15.5137%) 60 Secs ( 5.7211%) 300 Secs ( 4.4002%) diff --git a/tests/snmpsim/powerconnect_3046.snmprec b/tests/snmpsim/powerconnect_3046.snmprec new file mode 100644 index 0000000000..d7eb0f18c5 --- /dev/null +++ b/tests/snmpsim/powerconnect_3046.snmprec @@ -0,0 +1,3 @@ +1.3.6.1.2.1.1.1.0|4|Dell Networking N4064F, 6.5.4.3, Linux 3.7.10-8f4da1f6 +1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.674.10895.3046 +1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.9.0|4|5 Secs ( 19.4945%) 60 Secs ( 16.5480%) 300 Secs ( 16.2354%) diff --git a/tests/snmpsim/powerconnect_3053.snmprec b/tests/snmpsim/powerconnect_3053.snmprec new file mode 100644 index 0000000000..2fc408a58e --- /dev/null +++ b/tests/snmpsim/powerconnect_3053.snmprec @@ -0,0 +1,3 @@ +1.3.6.1.2.1.1.1.0|4|Dell Networking N2024, 6.1.0.6, Linux 3.6.5-320b2282 +1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.674.10895.3053 +1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.9.0|4|5 Secs ( 15.7961%) 60 Secs ( 16.2380%) 300 Secs ( 16.4519%) diff --git a/tests/snmpsim/powerconnect_3054.snmprec b/tests/snmpsim/powerconnect_3054.snmprec new file mode 100644 index 0000000000..ea82ca726a --- /dev/null +++ b/tests/snmpsim/powerconnect_3054.snmprec @@ -0,0 +1,3 @@ +1.3.6.1.2.1.1.1.0|4|Dell Networking N2048, 6.1.1.7, Linux 3.6.5-601418a5 +1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.674.10895.3054 +1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.9.0|4|5 Secs ( 18.523%) 60 Secs ( 7.4291%) 300 Secs ( 5.7341%) diff --git a/tests/snmpsim/powerconnect_3056.snmprec b/tests/snmpsim/powerconnect_3056.snmprec new file mode 100644 index 0000000000..cc64bad159 --- /dev/null +++ b/tests/snmpsim/powerconnect_3056.snmprec @@ -0,0 +1,3 @@ +1.3.6.1.2.1.1.1.0|4|Dell Networking N2048P, 6.1.0.6, Linux 3.6.5-320b2282 +1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.674.10895.3056 +1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.9.0|4|5 Secs ( 7.6384%) 60 Secs ( 5.9576%) 300 Secs ( 5.8516%) diff --git a/tests/snmpsim/powerconnect_3058.snmprec b/tests/snmpsim/powerconnect_3058.snmprec new file mode 100644 index 0000000000..051e857484 --- /dev/null +++ b/tests/snmpsim/powerconnect_3058.snmprec @@ -0,0 +1,3 @@ +1.3.6.1.2.1.1.1.0|4|Dell Networking N3048, 6.0.1.3, Linux 3.6.5-320b2282 +1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.674.10895.3058 +1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.9.0|4|5 Secs ( 33.1475%) 60 Secs ( 17.9669%) 300 Secs ( 13.2548%)