fix: Mitigate Cisco IOS 15 Stack State Issue (#8256)

This commit is contained in:
Søren Rosiak
2018-02-18 22:16:51 +01:00
committed by Neil Lathwood
parent 8ae48d9543
commit f8cceceeb6

View File

@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* Copyright (c) 2018 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
@@ -10,6 +10,9 @@
* the source code distribution for details.
*/
$role_data = snmpwalk_cache_oid($device, 'cswSwitchRole', array(), 'CISCO-STACKWISE-MIB');
$redundant_data = snmp_get($device, "cswRingRedundant.0", "-OQv", "CISCO-STACKWISE-MIB");
$tables = array(
array('ciscoEnvMonVoltageStatusTable','.1.3.6.1.4.1.9.9.13.1.2.1.7.','ciscoEnvMonVoltageState','ciscoEnvMonVoltageStatusDescr', 'CISCO-ENVMON-MIB') ,
array('ciscoEnvMonTemperatureStatusTable','.1.3.6.1.4.1.9.9.13.1.3.1.6.','ciscoEnvMonTemperatureState','ciscoEnvMonTemperatureStatusDescr', 'CISCO-ENVMON-MIB') ,
@@ -26,6 +29,11 @@ $tables = array(
);
foreach ($tables as $tablevalue) {
//Some switches on 15.x expose this information regardless if they are stacked or not, we try to mitigate that by doing the following.
if (($tablevalue[0] == 'cswGlobals' || $tablevalue[0] == 'cswSwitchRole' || $tablevalue[0] == 'cswSwitchState' || $tablevalue[0] == 'cswStackPortOperStatus') && $redundant_data == 'false' && count($role_data) == 1) {
continue;
}
$temp = snmpwalk_cache_multi_oid($device, $tablevalue[0], array(), $tablevalue[4]);
$cur_oid = $tablevalue[1];
@@ -162,3 +170,5 @@ foreach ($tables as $tablevalue) {
}
}
}
unset($role_data, $redundant_data);