mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fixed missing PoE graphs for Cisco devices (#11087)
* Fixed missing PoE graphs for Cisco devices where portIfIndex can't be retrieved from CISCO-STACK-MIB * Codeclimate & Travis error corrections Co-authored-by: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com>
This commit is contained in:
@@ -326,8 +326,18 @@ if (Config::get('enable_ports_poe')) {
|
||||
|
||||
if ($device['os'] == 'ios' || $device['os'] == 'iosxe') {
|
||||
echo 'cpeExtPsePortEntry';
|
||||
$port_stats_poe = snmpwalk_cache_oid($device, 'cpeExtPsePortEntry', array(), 'CISCO-POWER-ETHERNET-EXT-MIB');
|
||||
$port_ent_to_if = snmpwalk_cache_oid($device, 'portIfIndex', array(), 'CISCO-STACK-MIB');
|
||||
$port_stats_poe = snmpwalk_cache_oid($device, 'cpeExtPsePortEntry', [], 'CISCO-POWER-ETHERNET-EXT-MIB');
|
||||
$port_ent_to_if = snmpwalk_cache_oid($device, 'portIfIndex', [], 'CISCO-STACK-MIB');
|
||||
|
||||
if (!$port_ent_to_if) {
|
||||
$ifTable_ifDescr = snmpwalk_cache_oid($device, 'ifDescr', [], 'IF-MIB');
|
||||
$port_ent_to_if = [];
|
||||
foreach ($ifTable_ifDescr as $if_index => $if_descr) {
|
||||
if (preg_match('/^[[:alpha:]]+ethernet([0-9\/.]+)$/i', $if_descr['ifDescr'], $matches)) {
|
||||
$port_ent_to_if[str_replace('/', '.', $matches[1])] = ['portIfIndex' => $if_index];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($port_stats_poe as $p_index => $p_stats) {
|
||||
//We replace the ENTITY EntIndex by the IfIndex using the portIfIndex table (stored in $port_ent_to_if).
|
||||
|
Reference in New Issue
Block a user