Merge pull request #1505 from rasssta/issue-1504

Issue 1504
This commit is contained in:
Neil Lathwood 2015-07-22 11:41:41 +01:00
commit 322df9e006
9 changed files with 89 additions and 7 deletions

View File

@ -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;
}
}
?>

View File

@ -16,10 +16,11 @@ if ($device['os'] == 'xos') {
$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);
// 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);
}

View File

@ -0,0 +1,12 @@
<?php
if ($device['os'] == 'xos') {
echo 'EXTREME-SOFTWARE-MONITOR-MIB';
$total = str_replace('"', "", snmp_get($device, "1.3.6.1.4.1.1916.1.32.2.2.1.2.1", '-OvQ'));
$avail = str_replace('"', "", snmp_get($device, "1.3.6.1.4.1.1916.1.32.2.2.1.3.1", '-OvQ'));
if ((is_numeric($total)) && (is_numeric($avail))) {
discover_mempool($valid_mempool, $device, 0, 'extreme-mem', 'Dynamic Memory', '1', null, null);
}
}

View File

@ -8,9 +8,9 @@ if ($device['os'] == 'xos') {
$oid = "1.3.6.1.4.1.1916.1.1.1.40.1.0"; // extremeSystemPowerUsage
$value = snmp_get($device, $oid, '-Oqv', 'EXTREME-BASE-MIB');
$divisor = "1000";
$value = ($value / $divisor); // Nasty hack to divide the first value by 1000 since the divisor only works for polling after the sensor has been added
if (is_numeric($value)) {
$value = ($value / $divisor); // Nasty hack to divide the first value by 1000 since the divisor only works for polling after the sensor has been added
discover_sensor($valid['sensor'], 'power', $device, $oid, '1', 'extreme-power', $descr, $divisor, 1, null, null, null, null, $value); // No limits have been specified since all equipment is different and will use different amount of Watts
}
}

View File

@ -0,0 +1,18 @@
<?php
//
// Hardcoded discovery of CPU usage on Extreme devices.
//
// iso.3.6.1.4.1.1916.1.32.1.4.1.9.1 = STRING: "7.3"
if ($device['os'] == 'xos') {
echo 'EXTREME-BASE-MIB';
$descr = 'Processor';
$usage = str_replace('"', "", snmp_get($device, '1.3.6.1.4.1.1916.1.32.1.4.1.9.1', '-OvQ', 'EXTREME-BASE-MIB'));
if (is_numeric($usage)) {
discover_processor($valid['processor'], $device, '1.3.6.1.4.1.1916.1.32.1.4.1.9.1', '0', 'extreme-cpu', $descr, '100', $usage, null, null);
}
}
unset($processors_array);

View File

@ -0,0 +1,12 @@
<?php
if ($device['os'] == 'xos') {
echo 'EXTREME-SOFTWARE-MONITOR-MIB';
$total = str_replace('"', "", snmp_get($device, "1.3.6.1.4.1.1916.1.32.2.2.1.2.1", '-OvQ'));
$avail = str_replace('"', "", snmp_get($device, "1.3.6.1.4.1.1916.1.32.2.2.1.3.1", '-OvQ'));
$mempool['total'] = ($total * 1024);
$mempool['free'] = ($avail * 1024);
$mempool['used'] = (($total - $avail) * 1024);
}

View File

@ -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']);

View File

@ -0,0 +1,15 @@
<?php
//
// Hardcoded polling of CPU usage on Extreme devices due to the lack of multiplier for CPU usage.
//
// iso.3.6.1.4.1.1916.1.32.1.4.1.9.1 = STRING: "7.3"
if ($device['os'] == 'xos') {
$usage = str_replace('"', "", snmp_get($device, '1.3.6.1.4.1.1916.1.32.1.4.1.9.1', '-OvQ', 'EXTREME-BASE-MIB'));
if (is_numeric($usage)) {
$proc = ($usage * 100);
//substr(snmp_get($device, '1.3.6.1.4.1.1916.1.32.1.4.1.9.1', '-Ovq', 'EXTREME-BASE-MIB'), 0, 2);
}
}

View File

@ -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 X250e-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',
@ -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(