fix: Remove usage of -CI, it is not allowed for snmpbulkwalk #5164

This commit is contained in:
Tony Murray
2016-12-20 10:58:20 -06:00
committed by Neil Lathwood
parent 0cc9e774f9
commit 5c156e7e01
5 changed files with 3 additions and 47 deletions

View File

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

View File

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

View File

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

View File

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

View File

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