From ukfsoperator@poller-1, 7 Years ago, written in Plain Text.
Embed
  1. diff --git a/includes/polling/ports.inc.php b/includes/polling/ports.inc.php
  2. index 84c6def..0eae44a 100644
  3. --- a/includes/polling/ports.inc.php
  4. +++ b/includes/polling/ports.inc.php
  5. @@ -99,6 +99,9 @@ $cisco_oids = array(
  6.  
  7.  $pagp_oids = array(
  8.      'pagpOperationMode',
  9. +);
  10. +
  11. +$pagp_extended_oids = array(
  12.      'pagpPortState',
  13.      'pagpPartnerDeviceId',
  14.      'pagpPartnerLearnMethod',
  15. @@ -224,11 +227,11 @@ if ($device['os'] === 'f5' && (version_compare($device['version'], '11.2.0', '>=
  16.      }
  17.  }
  18.  
  19. -if ($config['enable_ports_etherlike']) {
  20. -    echo 'dot3Stats ';
  21. -    $port_stats = snmpwalk_cache_oid($device, 'dot3StatsEntry', $port_stats, 'EtherLike-MIB');
  22. -} else {
  23. +if ($device['os'] != 'asa') {
  24.      echo 'dot3StatsDuplexStatus';
  25. +    if ($config['enable_ports_poe'] || $config['enable_ports_etherlike']) {
  26. +        $port_stats = snmpwalk_cache_oid($device, 'dot3StatsIndex', $port_stats, 'EtherLike-MIB');
  27. +    }
  28.      $port_stats = snmpwalk_cache_oid($device, 'dot3StatsDuplexStatus', $port_stats, 'EtherLike-MIB');
  29.  }
  30.  
  31. @@ -265,13 +268,17 @@ if ($config['enable_ports_poe']) {
  32.      $port_stats = snmpwalk_cache_oid($device, 'cpeExtPsePortEntry', $port_stats, 'CISCO-POWER-ETHERNET-EXT-MIB');
  33.  }
  34.  
  35. -// FIXME This probably needs re-enabled. We need to clear these things when they get unset, too.
  36. -// foreach ($etherlike_oids as $oid) { $port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, "EtherLike-MIB"); }
  37. -// foreach ($cisco_oids as $oid)     { $port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, "OLD-CISCO-INTERFACES-MIB"); }
  38. -// foreach ($pagp_oids as $oid)      { $port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, "CISCO-PAGP-MIB"); }
  39.  if ($device['os_group'] == 'cisco' && $device['os'] != 'asa') {
  40.      foreach ($pagp_oids as $oid) {
  41. -        $port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, 'CISCO-PAGP-MIB');
  42. +        $pagp_port_stats = snmpwalk_cache_oid($device, $oid, array(), 'CISCO-PAGP-MIB');
  43. +    }
  44. +    if (count($pagp_port_stats) > 0) {
  45. +        foreach ($pagp_port_stats as $p_index => $p_stats) {
  46. +            $port_stats[$p_index]['pagpOperationMode'] = $p_stats['pagpOperationMode'];
  47. +        }
  48. +        foreach ($pagp_extended_oids as $oid) {
  49. +            $port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, 'CISCO-PAGP-MIB');
  50. +        }
  51.      }
  52.  
  53.      // Grab data to put ports into vlans or make them trunks
  54. @@ -280,7 +287,7 @@ if ($device['os_group'] == 'cisco' && $device['os'] != 'asa') {
  55.      $port_stats = snmpwalk_cache_oid($device, 'vlanTrunkPortEncapsulationOperType', $port_stats, 'CISCO-VTP-MIB');
  56.      $port_stats = snmpwalk_cache_oid($device, 'vlanTrunkPortNativeVlan', $port_stats, 'CISCO-VTP-MIB');
  57.  } else {
  58. -    $port_stats = snmpwalk_cache_oid($device, 'dot1qPortVlanTable', $port_stats, 'Q-BRIDGE-MIB');
  59. +    $port_stats = snmpwalk_cache_oid($device, 'dot1qPvid', $port_stats, 'Q-BRIDGE-MIB');
  60.  }//end if
  61.  
  62.  $polled = time();
  63. @@ -807,4 +814,4 @@ foreach ($ports as $port) {
  64.  } //end port update
  65.  
  66.  // Clear Variables Here
  67. -unset($port_stats, $ports_found, $data_oids, $stat_oids, $stat_oids_db, $stat_oids_db_extended, $etherlike_oids, $cisco_oids, $pagp_oids, $ifmib_oids, $hc_test, $ports_mapped, $ports, $_stat_oids, $rrd_def);
  68. +unset($port_stats, $ports_found, $data_oids, $stat_oids, $stat_oids_db, $stat_oids_db_extended, $cisco_oids, $pagp_oids, $ifmib_oids, $hc_test, $ports_mapped, $ports, $_stat_oids, $rrd_def);
  69.