From 5c156e7e0122e2e03565d4e2f9c0377b033d02ea Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Tue, 20 Dec 2016 10:58:20 -0600 Subject: [PATCH] fix: Remove usage of -CI, it is not allowed for snmpbulkwalk #5164 --- html/includes/graphs/device/bits.inc.php | 2 +- html/includes/graphs/global/bits.inc.php | 2 +- html/includes/graphs/location/bits.inc.php | 2 +- includes/polling/ports.inc.php | 4 --- includes/snmp.inc.php | 40 ---------------------- 5 files changed, 3 insertions(+), 47 deletions(-) diff --git a/html/includes/graphs/device/bits.inc.php b/html/includes/graphs/device/bits.inc.php index dd209e6716..16e5823df5 100644 --- a/html/includes/graphs/device/bits.inc.php +++ b/html/includes/graphs/device/bits.inc.php @@ -16,7 +16,7 @@ foreach (dbFetchRows('SELECT * FROM `ports` WHERE `device_id` = ?', array($devic if (is_array($config['device_traffic_descr'])) { foreach ($config['device_traffic_descr'] as $ifdescr) { - if (preg_match($ifdescr.'i', $port['ifDescr']) || preg_match($ifdescr.'i', $port['ifName']) || preg_match($ifdescr.'i', $port['portName'])) { + if (preg_match($ifdescr.'i', $port['ifDescr']) || preg_match($ifdescr.'i', $port['ifName'])) { $ignore = 1; } } diff --git a/html/includes/graphs/global/bits.inc.php b/html/includes/graphs/global/bits.inc.php index 494623f524..00f4ca660a 100644 --- a/html/includes/graphs/global/bits.inc.php +++ b/html/includes/graphs/global/bits.inc.php @@ -15,7 +15,7 @@ foreach (dbFetchRows('SELECT * FROM `ports` AS P, `devices` AS D WHERE D.device_ if (is_array($config['device_traffic_descr'])) { foreach ($config['device_traffic_descr'] as $ifdescr) { - if (preg_match($ifdescr.'i', $port['ifDescr']) || preg_match($ifdescr.'i', $port['ifName']) || preg_match($ifdescr.'i', $port['portName'])) { + if (preg_match($ifdescr.'i', $port['ifDescr']) || preg_match($ifdescr.'i', $port['ifName'])) { $ignore = 1; } } diff --git a/html/includes/graphs/location/bits.inc.php b/html/includes/graphs/location/bits.inc.php index 5b863a1654..c73000b91a 100644 --- a/html/includes/graphs/location/bits.inc.php +++ b/html/includes/graphs/location/bits.inc.php @@ -18,7 +18,7 @@ foreach ($devices as $device) { if (is_array($config['device_traffic_descr'])) { foreach ($config['device_traffic_descr'] as $ifdescr) { - if (preg_match($ifdescr.'i', $int['ifDescr']) || preg_match($ifdescr.'i', $int['ifName']) || preg_match($ifdescr.'i', $int['portName'])) { + if (preg_match($ifdescr.'i', $int['ifDescr']) || preg_match($ifdescr.'i', $int['ifName'])) { $ignore = 1; } } diff --git a/includes/polling/ports.inc.php b/includes/polling/ports.inc.php index d87102f236..bf5d963f2f 100644 --- a/includes/polling/ports.inc.php +++ b/includes/polling/ports.inc.php @@ -187,14 +187,10 @@ if ($config['enable_ports_poe']) { // foreach ($cisco_oids as $oid) { $port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, "OLD-CISCO-INTERFACES-MIB"); } // foreach ($pagp_oids as $oid) { $port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, "CISCO-PAGP-MIB"); } if ($device['os_group'] == 'cisco' && $device['os'] != 'asa') { - $port_stats = snmp_cache_portIfIndex($device, $port_stats); - $port_stats = snmp_cache_portName($device, $port_stats); foreach ($pagp_oids as $oid) { $port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, 'CISCO-PAGP-MIB'); } - $data_oids[] = 'portName'; - // Grab data to put ports into vlans or make them trunks // FIXME we probably shouldn't be doing this from the VTP MIB, right? $port_stats = snmpwalk_cache_oid($device, 'vmVlan', $port_stats, 'CISCO-VLAN-MEMBERSHIP-MIB'); diff --git a/includes/snmp.inc.php b/includes/snmp.inc.php index 8997d1b2ba..5568345410 100644 --- a/includes/snmp.inc.php +++ b/includes/snmp.inc.php @@ -568,46 +568,6 @@ function snmp_cache_port_oids($oids, $port, $device, $array, $mib = 0) }//end snmp_cache_port_oids() -function snmp_cache_portIfIndex($device, $array) -{ - $cmd = gen_snmpwalk_cmd($device, 'portIfIndex', ' -CI -Oq', 'CISCO-STACK-MIB'); - $output = trim(external_exec($cmd)); - - foreach (explode("\n", $output) as $entry) { - $entry = str_replace('CISCO-STACK-MIB::portIfIndex.', '', $entry); - list($slotport, $ifIndex) = explode(' ', $entry, 2); - if ($slotport && $ifIndex) { - $array[$ifIndex]['portIfIndex'] = $slotport; - $array[$slotport]['ifIndex'] = $ifIndex; - } - } - - return $array; -}//end snmp_cache_portIfIndex() - - -function snmp_cache_portName($device, $array) -{ - $cmd = gen_snmpwalk_cmd($device, 'portName', ' -CI -OQs', 'CISCO-STACK-MIB'); - $output = trim(external_exec($cmd)); - - // echo("Caching: portName\n"); - foreach (explode("\n", $output) as $entry) { - $entry = str_replace('portName.', '', $entry); - list($slotport, $portName) = explode('=', $entry, 2); - $slotport = trim($slotport); - $portName = trim($portName); - if ($array[$slotport]['ifIndex']) { - $ifIndex = $array[$slotport]['ifIndex']; - $array[$slotport]['portName'] = $portName; - $array[$ifIndex]['portName'] = $portName; - } - } - - return $array; -}//end snmp_cache_portName() - - function snmp_gen_auth(&$device) { global $debug, $vdebug;