From 00bb6b027441e9106c8be64f854f839f6ecdf6ed Mon Sep 17 00:00:00 2001 From: Rasmus Aberg Date: Tue, 21 Jul 2015 13:03:32 +0200 Subject: [PATCH 1/8] Added support for Extreme CPU usage + Memory, bug fix for Extreme Power, changes/additions in rewrites.inc.php and added support for some new Extreme platforms/features --- includes/discovery/mempools/extreme.inc.php | 12 ++++++++++++ includes/discovery/power/extreme.inc.php | 2 +- includes/discovery/processors/extreme.inc.php | 18 ++++++++++++++++++ includes/polling/mempools/extreme-mem.inc.php | 13 +++++++++++++ includes/polling/os/extremeware.inc.php | 7 ++++++- .../polling/processors/extreme-cpu.inc.php | 15 +++++++++++++++ includes/rewrites.php | 6 +++++- 7 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 includes/discovery/mempools/extreme.inc.php create mode 100644 includes/discovery/processors/extreme.inc.php create mode 100644 includes/polling/mempools/extreme-mem.inc.php create mode 100644 includes/polling/processors/extreme-cpu.inc.php diff --git a/includes/discovery/mempools/extreme.inc.php b/includes/discovery/mempools/extreme.inc.php new file mode 100644 index 000000000..45d35f697 --- /dev/null +++ b/includes/discovery/mempools/extreme.inc.php @@ -0,0 +1,12 @@ + diff --git a/includes/polling/os/extremeware.inc.php b/includes/polling/os/extremeware.inc.php index 94509495a..5ce0263c2 100644 --- a/includes/polling/os/extremeware.inc.php +++ b/includes/polling/os/extremeware.inc.php @@ -22,12 +22,17 @@ if (!strpos($poll_device['sysDescr'], 'XOS')) { else { // ExtremeXOS version 12.4.1.7 v1241b7 by release-manager on Sat Mar 13 02:36:57 EST 2010 // ExtremeWare XOS version 11.5.2.10 v1152b10 by release-manager on Thu Oct 26 09:53:04 PDT 2006 + // ExtremeXOS (X670-48x) version 15.5.2.9 v1552b9-patch1-5 by release-manager on Thu Sep 11 13:03:04 EDT 2014 echo " XOS \n"; - list($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l,$m) = explode(' ', str_replace('ExtremeWare XOS', 'ExtremeXOS', $poll_device['sysDescr'])); + list($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l,$m,$n) = explode(' ', str_replace('ExtremeWare XOS', 'ExtremeXOS', $poll_device['sysDescr'])); if ($b == 'version') { $version = $c; $features = $d.' '.$i.' '.$j.' '.$m; } + if ($c == 'version') { + $version = $d; + $features = $e.' '.$j.' '.$k.' '.$n; + } } $hardware = rewrite_extreme_hardware($poll_device['sysObjectID']); diff --git a/includes/polling/processors/extreme-cpu.inc.php b/includes/polling/processors/extreme-cpu.inc.php new file mode 100644 index 000000000..f45d63f24 --- /dev/null +++ b/includes/polling/processors/extreme-cpu.inc.php @@ -0,0 +1,15 @@ + 'Summit X250-24x', '.1.3.6.1.4.1.1916.2.92' => 'Summit X250-48p', '.1.3.6.1.4.1.1916.2.91' => 'Summit X250-48t', - '.1.3.6.1.4.1.1916.2.93' => 'Summit X250e-24t (3-Stack)', + '.1.3.6.1.4.1.1916.2.93' => 'Summit X250/X450-24t (3-Stack)', '.1.3.6.1.4.1.1916.2.88' => 'Summit X250e-24t (Single)', '.1.3.6.1.4.1.1916.2.66' => 'Summit X450-24t', '.1.3.6.1.4.1.1916.2.65' => 'Summit X450-24x', @@ -412,6 +412,8 @@ $rewrite_extreme_hardware = array( '.1.3.6.1.4.1.1916.2.129' => 'NWI-e450a', '.1.3.6.1.4.1.1916.2.133' => 'Summit x480-48t', '.1.3.6.1.4.1.1916.2.141' => 'Summit x480-48x', + '.1.3.6.1.4.1.1916.2.167' => 'Summit x670-48x', + '.1.3.6.1.4.1.1916.2.168' => 'Summit x670v-48x', ); $rewrite_ironware_hardware = array( @@ -665,6 +667,7 @@ $rewrite_ironware_hardware = array( 'snFESX624P' => 'FESX624POE+2XG-PREM', 'snFWSX424' => 'FWSX24G', 'snFWSX424Switch' => 'FWSX424', + 'FWSX24GSwitch' => 'FWSX424', 'snFWSX424Router' => 'FWSX424', 'snFWSX424Plus1XG' => 'FWSX24G + 1 10G', 'snFWSX424Plus1XGSwitch' => 'FWSX424+1XG', @@ -846,6 +849,7 @@ $rewrite_ironware_hardware = array( 'snCer2048C' => 'NetIron CER 2048C', 'snCer2048FX' => 'NetIron CER 2048F + 2x10G', 'snCer2048CX' => 'NetIron CER 2048C + 2x10G', + 'snTI2X24Router' => 'Stackable TurboIron-X24', ); $rewrite_ios_features = array( From 75e9a0fb270d75b7bb6c056fd3d303960c2fc3d1 Mon Sep 17 00:00:00 2001 From: Rasmus Aberg Date: Tue, 21 Jul 2015 13:39:53 +0200 Subject: [PATCH 2/8] added a fix to round limit values to avoid limits being updated on every discovery since a change of 1rpm in current rpm would cause a new limit since limits are based on the current value --- includes/discovery/fanspeeds/extreme.inc.php | 25 ++++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/includes/discovery/fanspeeds/extreme.inc.php b/includes/discovery/fanspeeds/extreme.inc.php index cd11b11d0..8897cf563 100644 --- a/includes/discovery/fanspeeds/extreme.inc.php +++ b/includes/discovery/fanspeeds/extreme.inc.php @@ -1,6 +1,17 @@ = 50) { + $ret = $val + (100-$diff); + } else { + $ret = $val - $diff; + } + return $ret; + } + echo(" EXTREME-BASE-MIB "); // Fan Speed @@ -13,13 +24,13 @@ if ($device['os'] == 'xos') { $index = $matches[1]; // substract 100 from index to start from 1 instead of 101 $modindex = ($index - 100); - $oid = "1.3.6.1.4.1.1916.1.1.1.9.1.4.$index"; - $value = snmp_get($device, $oid, '-Oqv', 'EXTREME-BASE-MIB'); - $descr = "Fan Speed $modindex"; - $high_limit = ($value * 1.5); - $high_warn_limit = ($value * 1.25); - $low_warn_limit = ($value * 0.75); - $low_limit = ($value * 0.5); + $oid = "1.3.6.1.4.1.1916.1.1.1.9.1.4.$index"; + $value = snmp_get($device, $oid, '-Oqv', 'EXTREME-BASE-MIB'); + $descr = "Fan Speed $modindex"; + $high_limit = roundme($value * 1.5); + $high_warn_limit = roundme($value * 1.25); + $low_warn_limit = roundme($value * 0.75); + $low_limit = roundme($value * 0.5); if (is_numeric($value)) { discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $index, 'extreme-fanspeed', $descr, '1', '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $value); } From aae9ba806c1de844170e6b4a1570eb7790169134 Mon Sep 17 00:00:00 2001 From: Rasmus Aberg Date: Tue, 21 Jul 2015 16:07:05 +0200 Subject: [PATCH 3/8] fixed formatting --- includes/discovery/fanspeeds/extreme.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/discovery/fanspeeds/extreme.inc.php b/includes/discovery/fanspeeds/extreme.inc.php index 8897cf563..9ce1a10a7 100644 --- a/includes/discovery/fanspeeds/extreme.inc.php +++ b/includes/discovery/fanspeeds/extreme.inc.php @@ -24,9 +24,9 @@ if ($device['os'] == 'xos') { $index = $matches[1]; // substract 100 from index to start from 1 instead of 101 $modindex = ($index - 100); - $oid = "1.3.6.1.4.1.1916.1.1.1.9.1.4.$index"; - $value = snmp_get($device, $oid, '-Oqv', 'EXTREME-BASE-MIB'); - $descr = "Fan Speed $modindex"; + $oid = "1.3.6.1.4.1.1916.1.1.1.9.1.4.$index"; + $value = snmp_get($device, $oid, '-Oqv', 'EXTREME-BASE-MIB'); + $descr = "Fan Speed $modindex"; $high_limit = roundme($value * 1.5); $high_warn_limit = roundme($value * 1.25); $low_warn_limit = roundme($value * 0.75); From 80cdbfcb4f9eaa7e4374e3ffc330d2897856cf08 Mon Sep 17 00:00:00 2001 From: Rasmus Aberg Date: Tue, 21 Jul 2015 16:14:38 +0200 Subject: [PATCH 4/8] fixed formatting --- includes/polling/mempools/extreme-mem.inc.php | 1 - 1 file changed, 1 deletion(-) diff --git a/includes/polling/mempools/extreme-mem.inc.php b/includes/polling/mempools/extreme-mem.inc.php index 6f38b0610..747270db7 100644 --- a/includes/polling/mempools/extreme-mem.inc.php +++ b/includes/polling/mempools/extreme-mem.inc.php @@ -10,4 +10,3 @@ if ($device['os'] == 'xos') { $mempool['free'] = ($avail * 1024); $mempool['used'] = (($total - $avail) * 1024); } -?> From d005b601b9751fffdb9f46aebea3ed1e96c9da5f Mon Sep 17 00:00:00 2001 From: Rasmus Aberg Date: Tue, 21 Jul 2015 17:08:09 +0200 Subject: [PATCH 5/8] moved roundme function to common.php and enabled it to round to 10th/100th/1000th based on of 10/100/1000 input --- includes/common.php | 15 +++++++++++ includes/discovery/fanspeeds/extreme.inc.php | 26 ++++++-------------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/includes/common.php b/includes/common.php index b0cd6c7af..af127932c 100644 --- a/includes/common.php +++ b/includes/common.php @@ -699,4 +699,19 @@ function get_graph_subtypes($type) { return $types; } +/* + * @return rounded value to 10th/100th/1000th depending on input (valid: 10, 100, 1000) + */ +function round_Nth($val = 0, $round_to) { + if (($round_to == "10") || ($round_to == "100") || ($round_to == "1000")) { + $diff = $val % $round_to; + if ($diff >= ($round_to / 2)) { + $ret = $val + ($round_to-$diff); + } else { + $ret = $val - $diff; + } + return $ret; + } +} + ?> diff --git a/includes/discovery/fanspeeds/extreme.inc.php b/includes/discovery/fanspeeds/extreme.inc.php index 9ce1a10a7..c314b8e2b 100644 --- a/includes/discovery/fanspeeds/extreme.inc.php +++ b/includes/discovery/fanspeeds/extreme.inc.php @@ -1,17 +1,6 @@ = 50) { - $ret = $val + (100-$diff); - } else { - $ret = $val - $diff; - } - return $ret; - } - echo(" EXTREME-BASE-MIB "); // Fan Speed @@ -24,13 +13,14 @@ if ($device['os'] == 'xos') { $index = $matches[1]; // substract 100 from index to start from 1 instead of 101 $modindex = ($index - 100); - $oid = "1.3.6.1.4.1.1916.1.1.1.9.1.4.$index"; - $value = snmp_get($device, $oid, '-Oqv', 'EXTREME-BASE-MIB'); - $descr = "Fan Speed $modindex"; - $high_limit = roundme($value * 1.5); - $high_warn_limit = roundme($value * 1.25); - $low_warn_limit = roundme($value * 0.75); - $low_limit = roundme($value * 0.5); + $oid = "1.3.6.1.4.1.1916.1.1.1.9.1.4.$index"; + $value = snmp_get($device, $oid, '-Oqv', 'EXTREME-BASE-MIB'); + $descr = "Fan Speed $modindex"; + // round function used to round limit values to hundreds to avoid h/w/l limits being changed on every discovery as a change of 1rpm for fan speed would cause the limit values to change since they're dynamically calculated + $high_limit = round_Nth(($value * 1.5), 100); + $high_warn_limit = round_Nth(($value * 1.25), 100); + $low_warn_limit = round_Nth(($value * 0.75), 100); + $low_limit = round_Nth(($value * 0.5), 100); if (is_numeric($value)) { discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $index, 'extreme-fanspeed', $descr, '1', '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $value); } From 2e95c1e194566283ba1313ee59a9f334be8e7bb8 Mon Sep 17 00:00:00 2001 From: Rasmus Aberg Date: Tue, 21 Jul 2015 20:30:02 +0200 Subject: [PATCH 6/8] fixed formatting --- includes/discovery/fanspeeds/extreme.inc.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/includes/discovery/fanspeeds/extreme.inc.php b/includes/discovery/fanspeeds/extreme.inc.php index c314b8e2b..414cc4d01 100644 --- a/includes/discovery/fanspeeds/extreme.inc.php +++ b/includes/discovery/fanspeeds/extreme.inc.php @@ -13,14 +13,14 @@ if ($device['os'] == 'xos') { $index = $matches[1]; // substract 100 from index to start from 1 instead of 101 $modindex = ($index - 100); - $oid = "1.3.6.1.4.1.1916.1.1.1.9.1.4.$index"; - $value = snmp_get($device, $oid, '-Oqv', 'EXTREME-BASE-MIB'); - $descr = "Fan Speed $modindex"; + $oid = "1.3.6.1.4.1.1916.1.1.1.9.1.4.$index"; + $value = snmp_get($device, $oid, '-Oqv', 'EXTREME-BASE-MIB'); + $descr = "Fan Speed $modindex"; // round function used to round limit values to hundreds to avoid h/w/l limits being changed on every discovery as a change of 1rpm for fan speed would cause the limit values to change since they're dynamically calculated - $high_limit = round_Nth(($value * 1.5), 100); - $high_warn_limit = round_Nth(($value * 1.25), 100); - $low_warn_limit = round_Nth(($value * 0.75), 100); - $low_limit = round_Nth(($value * 0.5), 100); + $high_limit = round_Nth(($value * 1.5), 100); + $high_warn_limit = round_Nth(($value * 1.25), 100); + $low_warn_limit = round_Nth(($value * 0.75), 100); + $low_limit = round_Nth(($value * 0.5), 100); if (is_numeric($value)) { discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $index, 'extreme-fanspeed', $descr, '1', '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $value); } From 9dae938d28e2ae63229cd6a40028f1ab84537ef1 Mon Sep 17 00:00:00 2001 From: Rasmus Aberg Date: Tue, 21 Jul 2015 20:39:13 +0200 Subject: [PATCH 7/8] fixed formatting --- includes/discovery/fanspeeds/extreme.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/discovery/fanspeeds/extreme.inc.php b/includes/discovery/fanspeeds/extreme.inc.php index 414cc4d01..983172d85 100644 --- a/includes/discovery/fanspeeds/extreme.inc.php +++ b/includes/discovery/fanspeeds/extreme.inc.php @@ -13,7 +13,7 @@ if ($device['os'] == 'xos') { $index = $matches[1]; // substract 100 from index to start from 1 instead of 101 $modindex = ($index - 100); - $oid = "1.3.6.1.4.1.1916.1.1.1.9.1.4.$index"; + $oid = "1.3.6.1.4.1.1916.1.1.1.9.1.4.$index"; $value = snmp_get($device, $oid, '-Oqv', 'EXTREME-BASE-MIB'); $descr = "Fan Speed $modindex"; // round function used to round limit values to hundreds to avoid h/w/l limits being changed on every discovery as a change of 1rpm for fan speed would cause the limit values to change since they're dynamically calculated From bc79fb07314311a97b8daf0cc077e9fe2f125d0e Mon Sep 17 00:00:00 2001 From: Rasmus Aberg Date: Tue, 21 Jul 2015 20:42:51 +0200 Subject: [PATCH 8/8] fixed minor typo --- includes/rewrites.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/rewrites.php b/includes/rewrites.php index 40409c10c..37ecf5b71 100644 --- a/includes/rewrites.php +++ b/includes/rewrites.php @@ -394,7 +394,7 @@ $rewrite_extreme_hardware = array( '.1.3.6.1.4.1.1916.2.90' => 'Summit X250-24x', '.1.3.6.1.4.1.1916.2.92' => 'Summit X250-48p', '.1.3.6.1.4.1.1916.2.91' => 'Summit X250-48t', - '.1.3.6.1.4.1.1916.2.93' => 'Summit X250/X450-24t (3-Stack)', + '.1.3.6.1.4.1.1916.2.93' => 'Summit X250/X450-24 (3-Stack)', '.1.3.6.1.4.1.1916.2.88' => 'Summit X250e-24t (Single)', '.1.3.6.1.4.1.1916.2.66' => 'Summit X450-24t', '.1.3.6.1.4.1.1916.2.65' => 'Summit X450-24x',