Commit version 24.12.13800
This commit is contained in:
@ -4,14 +4,16 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage poller
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage poller
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
// Exit if already founded fdb entries
|
||||
if (safe_count($fdbs)) { return; }
|
||||
if (safe_count($fdbs)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
AtiStackSwitch9424-MIB::atiStkSwMacAddrPortId[0:1:80:4a:17:19][30] = 23
|
||||
@ -20,28 +22,25 @@ AtiStackSwitch9424-MIB::atiStkSwMacAddrPortId[0:1:80:4a:17:19][30] = 23
|
||||
$entries = snmpwalk_cache_twopart_oid($device, 'atiStkSwMacAddrPortId', [], $mib, NULL, OBS_SNMP_ALL_TABLE);
|
||||
print_debug_vars($entries);
|
||||
|
||||
foreach($entries as $mac => $data1)
|
||||
{
|
||||
foreach ($data1 as $vlan => $entry)
|
||||
{
|
||||
// Make sure the ifIndex is actually valid
|
||||
if ($entry['atiStkSwMacAddrPortId'] != 0 && is_array($port_ifIndex_table[$entry['atiStkSwMacAddrPortId']]))
|
||||
{
|
||||
$port = $port_ifIndex_table[$entry['atiStkSwMacAddrPortId']];
|
||||
foreach ($entries as $mac => $data1) {
|
||||
foreach ($data1 as $vlan => $entry) {
|
||||
// Make sure the ifIndex is actually valid
|
||||
if ($entry['atiStkSwMacAddrPortId'] != 0 && is_array($port_ifIndex_table[$entry['atiStkSwMacAddrPortId']])) {
|
||||
$port = $port_ifIndex_table[$entry['atiStkSwMacAddrPortId']];
|
||||
|
||||
$mac = mac_zeropad($mac);
|
||||
$mac = mac_zeropad($mac);
|
||||
|
||||
$data = [];
|
||||
$data = [];
|
||||
|
||||
$data['port_id'] = $port['port_id'];
|
||||
$data['port_index'] = $entry['atiStkSwMacAddrPortId'];
|
||||
$data['fdb_status'] = 'learned';
|
||||
$data['port_id'] = $port['port_id'];
|
||||
$data['port_index'] = $entry['atiStkSwMacAddrPortId'];
|
||||
$data['fdb_status'] = 'learned';
|
||||
|
||||
$fdbs[$vlan][$mac] = $data;
|
||||
$fdbs[$vlan][$mac] = $data;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
unset($entries);
|
||||
|
61
includes/polling/fdb/bridge-mib.php
Normal file
61
includes/polling/fdb/bridge-mib.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage poller
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
// NOTE. Do not include in mib way! Directly include.
|
||||
|
||||
if (!safe_empty($fdbs) || !is_device_mib($device, 'BRIDGE-MIB')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Note, BRIDGE-MIB not have Vlan information
|
||||
$dot1dTpFdbEntry_table = snmpwalk_cache_oid($device, 'dot1dTpFdbPort', [], 'BRIDGE-MIB', NULL, OBS_SNMP_ALL_TABLE);
|
||||
|
||||
if (snmp_status()) {
|
||||
$dot1dTpFdbEntry_table = snmpwalk_cache_oid($device, 'dot1dTpFdbStatus', $dot1dTpFdbEntry_table, 'BRIDGE-MIB', NULL, OBS_SNMP_ALL_TABLE);
|
||||
print_debug_vars($dot1dTpFdbEntry_table);
|
||||
|
||||
$dot1dBasePort_table = [];
|
||||
if ($device['os'] === 'routeros' && version_compare($device['version'], '6.47', '>=')) {
|
||||
// See: https://jira.observium.org/browse/OBS-4373
|
||||
|
||||
// Build dot1dBasePort
|
||||
foreach (snmpwalk_cache_oid($device, 'dot1dBasePortIfIndex', [], 'BRIDGE-MIB') as $dot1dbaseport => $entry) {
|
||||
$dot1dBasePort_table[$dot1dbaseport] = $port_ifIndex_table[$entry['dot1dBasePortIfIndex']];
|
||||
}
|
||||
print_debug_vars($dot1dBasePort_table);
|
||||
}
|
||||
|
||||
$vlan = 0; // BRIDGE-MIB not have Vlan information
|
||||
foreach ($dot1dTpFdbEntry_table as $mac => $entry) {
|
||||
$mac = mac_zeropad($mac);
|
||||
|
||||
$fdb_port = $entry['dot1dTpFdbPort'];
|
||||
|
||||
$data = [];
|
||||
if (isset($dot1dBasePort_table[$fdb_port])) {
|
||||
// See: https://jira.observium.org/browse/OBS-4373
|
||||
$data['port_id'] = $dot1dBasePort_table[$fdb_port]['port_id'];
|
||||
$data['port_index'] = $dot1dBasePort_table[$fdb_port]['ifIndex'];
|
||||
} else {
|
||||
$data['port_id'] = $port_ifIndex_table[$fdb_port]['port_id'];
|
||||
$data['port_index'] = $fdb_port;
|
||||
}
|
||||
$data['fdb_status'] = $entry['dot1dTpFdbStatus'];
|
||||
|
||||
$fdbs[$vlan][$mac] = $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
unset($dot1dTpFdbEntry_table, $dot1dBasePort_table);
|
||||
|
||||
// EOF
|
97
includes/polling/fdb/cisco-bridge-mib.php
Normal file
97
includes/polling/fdb/cisco-bridge-mib.php
Normal file
@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage poller
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
// NOTE. Do not include in mib way! Directly include.
|
||||
|
||||
if (!safe_empty($fdbs) || !is_device_mib($device, 'Q-BRIDGE-MIB')) {
|
||||
// Really there is BRIDGE-MIB, but as in old way we check for Q-BRIDGE-MIB
|
||||
return;
|
||||
}
|
||||
|
||||
// I think this is global, not per-VLAN. (in normal world..)
|
||||
// But NOPE, this is Cisco way (probably for pvst) @mike
|
||||
// See: https://jira.observium.org/browse/OBS-2813
|
||||
//
|
||||
// From same device example default and vlan 103:
|
||||
// snmpbulkwalk -v2c community -m BRIDGE-MIB -M /srv/observium/mibs/rfc:/srv/observium/mibs/net-snmp sw-1917 dot1dBasePortIfIndex
|
||||
//BRIDGE-MIB::dot1dBasePortIfIndex.49 = INTEGER: 10101
|
||||
//BRIDGE-MIB::dot1dBasePortIfIndex.50 = INTEGER: 10102
|
||||
// snmpbulkwalk -v2c community@103 -m BRIDGE-MIB -M /srv/observium/mibs/rfc:/srv/observium/mibs/net-snmp sw-1917 dot1dBasePortIfIndex
|
||||
//BRIDGE-MIB::dot1dBasePortIfIndex.1 = INTEGER: 10001
|
||||
//BRIDGE-MIB::dot1dBasePortIfIndex.3 = INTEGER: 10003
|
||||
//BRIDGE-MIB::dot1dBasePortIfIndex.4 = INTEGER: 10004
|
||||
//...
|
||||
// But I will try to pre-cache, this fetch port association for default (1) vlan only!
|
||||
$dot1dBasePort_table = [];
|
||||
$dot1dBasePortIfIndex[1] = snmpwalk_cache_oid($device, 'dot1dBasePortIfIndex', [], 'BRIDGE-MIB');
|
||||
foreach ($dot1dBasePortIfIndex[1] as $base_port => $data) {
|
||||
$dot1dBasePort_table[$base_port] = $port_ifIndex_table[$data['dot1dBasePortIfIndex']];
|
||||
}
|
||||
|
||||
// Fetch list of active VLANs (with vlan context exist)
|
||||
$sql = 'SELECT DISTINCT `vlan_vlan` FROM `vlans` WHERE `device_id` = ? AND `vlan_context` = ? AND (`vlan_status` = ? OR `vlan_status` = ?)';
|
||||
foreach (dbFetchRows($sql, [ $device['device_id'], 1, 'active', 'operational']) as $cisco_vlan) {
|
||||
$vlan = $cisco_vlan['vlan_vlan'];
|
||||
|
||||
// Set per-VLAN context
|
||||
$device_context = $device;
|
||||
// Add vlan context for snmp auth
|
||||
if ($device['snmp_version'] === 'v3') {
|
||||
$device_context['snmp_context'] = 'vlan-' . $vlan;
|
||||
} else {
|
||||
$device_context['snmp_context'] = $vlan;
|
||||
}
|
||||
//$device_context['snmp_retries'] = 1; // Set retries to 0 for speedup walking
|
||||
|
||||
//dot1dTpFdbAddress[0:7:e:6d:55:41] 0:7:e:6d:55:41
|
||||
//dot1dTpFdbPort[0:7:e:6d:55:41] 28
|
||||
//dot1dTpFdbStatus[0:7:e:6d:55:41] learned
|
||||
$dot1dTpFdbEntry_table = snmpwalk_multipart_oid($device_context, 'dot1dTpFdbEntry', [], 'BRIDGE-MIB', NULL, OBS_SNMP_ALL_TABLE);
|
||||
|
||||
if (!snmp_status()) {
|
||||
// Continue if no entries for vlan
|
||||
unset($device_context);
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($dot1dTpFdbEntry_table as $mac => $entry) {
|
||||
$mac = mac_zeropad($mac);
|
||||
$fdb_port = $entry['dot1dTpFdbPort'];
|
||||
|
||||
// If not exist ifIndex associations from previous walks, fetch association for current vlan context
|
||||
// This is derp, but I not know better speedup this walks
|
||||
if (!isset($dot1dBasePort_table[$fdb_port]) && !isset($dot1dBasePortIfIndex[$vlan])) {
|
||||
print_debug("Cache dot1dBasePort -> IfIndex association table by vlan $vlan");
|
||||
// Need to walk port association for this vlan context
|
||||
$dot1dBasePortIfIndex[$vlan] = snmpwalk_cache_oid($device_context, 'dot1dBasePortIfIndex', [], 'BRIDGE-MIB');
|
||||
foreach ($dot1dBasePortIfIndex[$vlan] as $base_port => $data) {
|
||||
$dot1dBasePort_table[$base_port] = $port_ifIndex_table[$data['dot1dBasePortIfIndex']];
|
||||
}
|
||||
// Prevent rewalk in cycle if empty output
|
||||
if (is_null($dot1dBasePortIfIndex[$vlan])) {
|
||||
$dot1dBasePortIfIndex[$vlan] = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
$data = [];
|
||||
|
||||
$data['port_id'] = $dot1dBasePort_table[$fdb_port]['port_id'];
|
||||
$data['port_index'] = isset($dot1dBasePort_table[$fdb_port]) ? $dot1dBasePort_table[$fdb_port]['ifIndex'] : $fdb_port;
|
||||
$data['fdb_status'] = $entry['dot1dTpFdbStatus'];
|
||||
|
||||
$fdbs[$vlan][$mac] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
unset($dot1dBasePortIfIndex, $dot1dTpFdbEntry_table, $dot1dBasePort_table);
|
||||
|
||||
// EOF
|
@ -4,57 +4,54 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage poller
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage poller
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
// Exit if already founded fdb entries
|
||||
if (safe_count($fdbs)) { return; }
|
||||
if (safe_count($fdbs)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// EXTREME-FDB-MIB::extremeFdbMacExosFdbPortIfIndex[0:4:96:52:f1:1d][1000053] = 1052
|
||||
// EXTREME-FDB-MIB::extremeFdbMacExosFdbStatus[0:4:96:52:f1:1d][1000053] = learned
|
||||
$entries = snmpwalk_cache_twopart_oid($device, 'extremeFdbMacExosFdbPortIfIndex', array(), 'EXTREME-FDB-MIB', NULL, OBS_SNMP_ALL_TABLE);
|
||||
$entries = snmpwalk_cache_twopart_oid($device, 'extremeFdbMacExosFdbPortIfIndex', [], 'EXTREME-FDB-MIB', NULL, OBS_SNMP_ALL_TABLE);
|
||||
|
||||
if (snmp_status())
|
||||
{
|
||||
$entries = snmpwalk_cache_twopart_oid($device, 'extremeFdbMacExosFdbStatus', $entries, 'EXTREME-FDB-MIB', NULL, OBS_SNMP_ALL_TABLE);
|
||||
print_debug_vars($entries);
|
||||
if (snmp_status()) {
|
||||
$entries = snmpwalk_cache_twopart_oid($device, 'extremeFdbMacExosFdbStatus', $entries, 'EXTREME-FDB-MIB', NULL, OBS_SNMP_ALL_TABLE);
|
||||
print_debug_vars($entries);
|
||||
|
||||
foreach($entries as $mac => $data1)
|
||||
{
|
||||
foreach ($data1 as $vlan_index => $entry)
|
||||
{
|
||||
foreach ($entries as $mac => $data1) {
|
||||
foreach ($data1 as $vlan_index => $entry) {
|
||||
|
||||
// Seach vlan number by discovered vlans
|
||||
$vlan_port = $port_ifIndex_table[$vlan_index];
|
||||
if (preg_match('/^VLAN\s*0*(\d+)/i', $vlan_port['ifDescr'], $matches))
|
||||
{
|
||||
$vlan = $matches[1];
|
||||
} else {
|
||||
$vlan = $vlan_index; // Incorrect, but better than nothing
|
||||
}
|
||||
// Seach vlan number by discovered vlans
|
||||
$vlan_port = $port_ifIndex_table[$vlan_index];
|
||||
if (preg_match('/^VLAN\s*0*(\d+)/i', $vlan_port['ifDescr'], $matches)) {
|
||||
$vlan = $matches[1];
|
||||
} else {
|
||||
$vlan = $vlan_index; // Incorrect, but better than nothing
|
||||
}
|
||||
|
||||
// Make sure the ifIndex is actually valid
|
||||
if ($entry['extremeFdbMacExosFdbPortIfIndex'] != 0 && is_array($port_ifIndex_table[$entry['extremeFdbMacExosFdbPortIfIndex']]))
|
||||
{
|
||||
$port = $port_ifIndex_table[$entry['extremeFdbMacExosFdbPortIfIndex']];
|
||||
// Make sure the ifIndex is actually valid
|
||||
if ($entry['extremeFdbMacExosFdbPortIfIndex'] != 0 && is_array($port_ifIndex_table[$entry['extremeFdbMacExosFdbPortIfIndex']])) {
|
||||
$port = $port_ifIndex_table[$entry['extremeFdbMacExosFdbPortIfIndex']];
|
||||
|
||||
$mac = mac_zeropad($mac);
|
||||
$mac = mac_zeropad($mac);
|
||||
|
||||
$data = array();
|
||||
$data = [];
|
||||
|
||||
$data['port_id'] = $port['port_id'];
|
||||
$data['port_index'] = $entry['extremeFdbMacExosFdbPortIfIndex'];
|
||||
$data['fdb_status'] = $entry['extremeFdbMacExosFdbStatus'];
|
||||
$data['port_id'] = $port['port_id'];
|
||||
$data['port_index'] = $entry['extremeFdbMacExosFdbPortIfIndex'];
|
||||
$data['fdb_status'] = $entry['extremeFdbMacExosFdbStatus'];
|
||||
|
||||
$fdbs[$vlan][$mac] = $data;
|
||||
$fdbs[$vlan][$mac] = $data;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($entries);
|
||||
|
@ -4,42 +4,44 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage poller
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage poller
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
// Exit if already founded fdb entries
|
||||
if (safe_count($fdbs)) { return; }
|
||||
if (safe_count($fdbs)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// hwDynFdbPort[0:e0:4c:xx:xx:xx][99][0] 7
|
||||
$entries = snmpwalk_cache_threepart_oid($device, 'hwDynFdbPort', array(), 'HUAWEI-L2MAM-MIB', NULL, OBS_SNMP_ALL_TABLE);
|
||||
$entries = snmpwalk_cache_threepart_oid($device, 'hwDynFdbPort', [], 'HUAWEI-L2MAM-MIB', NULL, OBS_SNMP_ALL_TABLE);
|
||||
print_debug_vars($entries);
|
||||
|
||||
if (snmp_status()) {
|
||||
foreach ($entries as $mac => $data1) {
|
||||
foreach ($data1 as $vlan => $data2) {
|
||||
foreach ($data2 as $vsi => $entry) {
|
||||
foreach ($entries as $mac => $data1) {
|
||||
foreach ($data1 as $vlan => $data2) {
|
||||
foreach ($data2 as $vsi => $entry) {
|
||||
|
||||
// Make sure the ifIndex is actually valid
|
||||
if ($entry['hwDynFdbPort'] != 0 && is_array($port_ifIndex_table[$entry['hwDynFdbPort']])) {
|
||||
$port = $port_ifIndex_table[$entry['hwDynFdbPort']];
|
||||
$mac = mac_zeropad($mac);
|
||||
// Make sure the ifIndex is actually valid
|
||||
if ($entry['hwDynFdbPort'] != 0 && is_array($port_ifIndex_table[$entry['hwDynFdbPort']])) {
|
||||
$port = $port_ifIndex_table[$entry['hwDynFdbPort']];
|
||||
$mac = mac_zeropad($mac);
|
||||
|
||||
$data = array();
|
||||
$data = [];
|
||||
|
||||
$data['port_id'] = $port['port_id'];
|
||||
$data['port_index'] = $entry['hwDynFdbPort'];
|
||||
$data['fdb_status'] = 'learned'; // Hardcoded for this MIB
|
||||
$data['port_id'] = $port['port_id'];
|
||||
$data['port_index'] = $entry['hwDynFdbPort'];
|
||||
$data['fdb_status'] = 'learned'; // Hardcoded for this MIB
|
||||
|
||||
$fdbs[$vlan][$mac] = $data;
|
||||
$fdbs[$vlan][$mac] = $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($entries);
|
||||
//return;
|
||||
unset($entries);
|
||||
//return;
|
||||
}
|
||||
|
||||
// Alternative entries
|
||||
|
87
includes/polling/fdb/q-bridge-mib.php
Normal file
87
includes/polling/fdb/q-bridge-mib.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage poller
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
// NOTE. Do not include in mib way! Directly include.
|
||||
|
||||
if (!safe_empty($fdbs) || !is_device_mib($device, 'Q-BRIDGE-MIB')) {
|
||||
// Q-BRIDGE-MIB already blacklisted for vrp
|
||||
return;
|
||||
}
|
||||
|
||||
//dot1qTpFdbPort[1][0:0:5e:0:1:1] 50
|
||||
//dot1qTpFdbStatus[1][0:0:5e:0:1:1] learned
|
||||
|
||||
if ($device['os'] === 'junos' || $device['os'] === 'junos-evo') {
|
||||
// JUNOS doesn't use the actual vlan ids for much in Q-BRIDGE-MIB
|
||||
// but we can get the vlan names and use that to lookup the actual
|
||||
// vlan ids that were found with JUNIPER-VLAN-MIB during discovery
|
||||
|
||||
// Fetch list of active VLANs
|
||||
$vlanidsbyname = [];
|
||||
foreach (dbFetchRows('SELECT `vlan_vlan`,`vlan_name` FROM `vlans` WHERE (`vlan_status` = ? OR `vlan_status` = ?) AND `device_id` = ?', ['active', 'operational', $device['device_id']]) as $entry) {
|
||||
$vlanidsbyname[$entry['vlan_name']] = $entry['vlan_vlan'];
|
||||
}
|
||||
|
||||
// getting the names as listed by Q-BRIDGE-MIB
|
||||
// and making a mapping to the real vlan ids
|
||||
if (count($vlanidsbyname)) {
|
||||
foreach (snmpwalk_cache_oid($device, 'dot1qVlanStaticName', [], 'Q-BRIDGE-MIB', NULL, OBS_SNMP_ALL_TABLE) as $id => $entry) {
|
||||
$juniper_vlans[$id] = $vlanidsbyname[$entry['dot1qVlanStaticName']];
|
||||
}
|
||||
}
|
||||
unset($vlanidsbyname);
|
||||
}
|
||||
|
||||
// Dell OS10 return strange additional num, see:
|
||||
// https://jira.observium.org/browse/OBS-3213
|
||||
//dot1qTpFdbPort[4][6:0:24:38:93:c8].0 = 59
|
||||
//dot1qTpFdbPort[4][6:0:50:56:95:51].221 = 59
|
||||
$dot1qTpFdbEntry_table = snmpwalk_cache_oid($device, 'dot1qTpFdbEntry', [], 'Q-BRIDGE-MIB', NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
|
||||
if (snmp_status()) {
|
||||
// Build dot1dBasePort
|
||||
foreach (snmpwalk_cache_oid($device, 'dot1dBasePortIfIndex', [], 'BRIDGE-MIB') as $dot1dbaseport => $entry) {
|
||||
$dot1dBasePort_table[$dot1dbaseport] = $port_ifIndex_table[$entry['dot1dBasePortIfIndex']];
|
||||
}
|
||||
|
||||
foreach ($dot1qTpFdbEntry_table as $index => $entry) {
|
||||
$index_array = explode('.', $index);
|
||||
$vlan = array_shift($index_array);
|
||||
if (count($index_array) > 6) {
|
||||
// Remove first (strange, incorrect) mac part
|
||||
array_shift($index_array);
|
||||
}
|
||||
// reimplode index to mac
|
||||
$mac = '';
|
||||
foreach ($index_array as $mac_num) {
|
||||
$mac .= dechex($mac_num) . ':';
|
||||
}
|
||||
$mac = mac_zeropad(trim($mac, ':'));
|
||||
|
||||
// if we have a translated vlan id for Juniper, use it
|
||||
if (isset($juniper_vlans[$vlan])) {
|
||||
$vlan = $juniper_vlans[$vlan];
|
||||
}
|
||||
|
||||
$fdb_port = $entry['dot1qTpFdbPort'];
|
||||
|
||||
$data = [];
|
||||
$data['port_id'] = $dot1dBasePort_table[$fdb_port]['port_id'];
|
||||
$data['port_index'] = isset($dot1dBasePort_table[$fdb_port]) ? $dot1dBasePort_table[$fdb_port]['ifIndex'] : $fdb_port;
|
||||
$data['fdb_status'] = $entry['dot1qTpFdbStatus'];
|
||||
|
||||
$fdbs[$vlan][$mac] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
unset($juniper_vlans, $dot1qTpFdbEntry_table, $dot1dBasePort_table);
|
||||
|
||||
// EOF
|
@ -4,94 +4,86 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage poller
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage poller
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
// Exit if already founded fdb entries
|
||||
if (safe_count($fdbs)) { return; }
|
||||
if (safe_count($fdbs)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
RAPID-CITY::rcBridgeNewFdbStatus[0:1:59:2:36:40][6] = learned
|
||||
RAPID-CITY::rcBridgeNewFdbPort[0:1:59:2:36:40][6] = 662
|
||||
*/
|
||||
|
||||
$entries = snmpwalk_cache_twopart_oid($device, 'rcBridgeNewFdbPort', array(), 'RAPID-CITY', NULL, OBS_SNMP_ALL_TABLE);
|
||||
$entries = snmpwalk_cache_twopart_oid($device, 'rcBridgeNewFdbPort', [], 'RAPID-CITY', NULL, OBS_SNMP_ALL_TABLE);
|
||||
|
||||
if (snmp_status())
|
||||
{
|
||||
$entries = snmpwalk_cache_twopart_oid($device, 'rcBridgeNewFdbStatus', $entries, 'RAPID-CITY', NULL, OBS_SNMP_ALL_TABLE);
|
||||
print_debug_vars($entries);
|
||||
|
||||
foreach($entries as $mac => $data1)
|
||||
{
|
||||
foreach ($data1 as $vlan => $entry)
|
||||
{
|
||||
|
||||
// Make sure the ifIndex is actually valid
|
||||
if ($entry['rcBridgeNewFdbPort'] != 0 && is_array($port_ifIndex_table[$entry['rcBridgeNewFdbPort']]))
|
||||
{
|
||||
$port = $port_ifIndex_table[$entry['rcBridgeNewFdbPort']];
|
||||
|
||||
$mac = mac_zeropad($mac);
|
||||
|
||||
$data = array();
|
||||
|
||||
$data['port_id'] = $port['port_id'];
|
||||
$data['port_index'] = $entry['rcBridgeNewFdbPort'];
|
||||
$data['fdb_status'] = $entry['rcBridgeNewFdbStatus'];
|
||||
|
||||
$fdbs[$vlan][$mac] = $data;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// if its not rcBridge then may be its spbm
|
||||
|
||||
// rcBridgeSpbmMacStatus[1500050][14:61:2f:ec:49:1] = learned
|
||||
// rcBridgeSpbmMacCPort[1500050][14:61:2f:ec:49:1] = 50
|
||||
$entries = snmpwalk_cache_twopart_oid($device, 'rcBridgeSpbmMacCPort', array(), 'RAPID-CITY', NULL, OBS_SNMP_ALL_TABLE);
|
||||
if (snmp_status())
|
||||
{
|
||||
$entries = snmpwalk_cache_twopart_oid($device, 'rcBridgeSpbmMacStatus', $entries, 'RAPID-CITY', NULL, OBS_SNMP_ALL_TABLE);
|
||||
if (snmp_status()) {
|
||||
$entries = snmpwalk_cache_twopart_oid($device, 'rcBridgeNewFdbStatus', $entries, 'RAPID-CITY', NULL, OBS_SNMP_ALL_TABLE);
|
||||
print_debug_vars($entries);
|
||||
|
||||
$entries = snmpwalk_cache_twopart_oid($device, 'rcBridgeSpbmMacType', $entries, 'RAPID-CITY', NULL, OBS_SNMP_ALL_TABLE);
|
||||
print_debug_vars($entries);
|
||||
|
||||
$entries = snmpwalk_cache_twopart_oid($device, 'rcBridgeSpbmMacCVlanId', $entries, 'RAPID-CITY', NULL, OBS_SNMP_ALL_TABLE);
|
||||
print_debug_vars($entries);
|
||||
|
||||
foreach($entries as $isid => $data1)
|
||||
{
|
||||
foreach ($data1 as $mac => $entry)
|
||||
{
|
||||
|
||||
// Make sure the ifIndex is actually valid
|
||||
if ($entry['rcBridgeSpbmMacType'] == "local" && is_array($port_ifIndex_table[$entry['rcBridgeSpbmMacCPort']]))
|
||||
{
|
||||
$port = $port_ifIndex_table[$entry['rcBridgeSpbmMacCPort']];
|
||||
|
||||
$mac = mac_zeropad($mac);
|
||||
|
||||
$data = array();
|
||||
|
||||
$data['port_id'] = $port['port_id'];
|
||||
$data['port_index'] = $entry['rcBridgeSpbmMacCPort'];
|
||||
$data['fdb_status'] = $entry['rcBridgeSpbmMacStatus'];
|
||||
$vlan = $entry['rcBridgeSpbmMacCVlanId'];
|
||||
|
||||
$fdbs[$vlan][$mac] = $data;
|
||||
|
||||
foreach ($entries as $mac => $data1) {
|
||||
foreach ($data1 as $vlan => $entry) {
|
||||
|
||||
// Make sure the ifIndex is actually valid
|
||||
if ($entry['rcBridgeNewFdbPort'] != 0 && is_array($port_ifIndex_table[$entry['rcBridgeNewFdbPort']])) {
|
||||
$port = $port_ifIndex_table[$entry['rcBridgeNewFdbPort']];
|
||||
|
||||
$mac = mac_zeropad($mac);
|
||||
|
||||
$data = [];
|
||||
|
||||
$data['port_id'] = $port['port_id'];
|
||||
$data['port_index'] = $entry['rcBridgeNewFdbPort'];
|
||||
$data['fdb_status'] = $entry['rcBridgeNewFdbStatus'];
|
||||
|
||||
$fdbs[$vlan][$mac] = $data;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// if its not rcBridge then may be its spbm
|
||||
|
||||
// rcBridgeSpbmMacStatus[1500050][14:61:2f:ec:49:1] = learned
|
||||
// rcBridgeSpbmMacCPort[1500050][14:61:2f:ec:49:1] = 50
|
||||
$entries = snmpwalk_cache_twopart_oid($device, 'rcBridgeSpbmMacCPort', [], 'RAPID-CITY', NULL, OBS_SNMP_ALL_TABLE);
|
||||
if (snmp_status()) {
|
||||
$entries = snmpwalk_cache_twopart_oid($device, 'rcBridgeSpbmMacStatus', $entries, 'RAPID-CITY', NULL, OBS_SNMP_ALL_TABLE);
|
||||
print_debug_vars($entries);
|
||||
|
||||
$entries = snmpwalk_cache_twopart_oid($device, 'rcBridgeSpbmMacType', $entries, 'RAPID-CITY', NULL, OBS_SNMP_ALL_TABLE);
|
||||
print_debug_vars($entries);
|
||||
|
||||
$entries = snmpwalk_cache_twopart_oid($device, 'rcBridgeSpbmMacCVlanId', $entries, 'RAPID-CITY', NULL, OBS_SNMP_ALL_TABLE);
|
||||
print_debug_vars($entries);
|
||||
|
||||
foreach ($entries as $isid => $data1) {
|
||||
foreach ($data1 as $mac => $entry) {
|
||||
|
||||
// Make sure the ifIndex is actually valid
|
||||
if ($entry['rcBridgeSpbmMacType'] == "local" && is_array($port_ifIndex_table[$entry['rcBridgeSpbmMacCPort']])) {
|
||||
$port = $port_ifIndex_table[$entry['rcBridgeSpbmMacCPort']];
|
||||
|
||||
$mac = mac_zeropad($mac);
|
||||
|
||||
$data = [];
|
||||
|
||||
$data['port_id'] = $port['port_id'];
|
||||
$data['port_index'] = $entry['rcBridgeSpbmMacCPort'];
|
||||
$data['fdb_status'] = $entry['rcBridgeSpbmMacStatus'];
|
||||
$vlan = $entry['rcBridgeSpbmMacCVlanId'];
|
||||
|
||||
$fdbs[$vlan][$mac] = $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($entries);
|
||||
|
@ -4,22 +4,26 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage poller
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage poller
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
// Exit if already founded fdb entries
|
||||
if (safe_count($fdbs)) { return; }
|
||||
if (safe_count($fdbs)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TPLINK-L2BRIDGE-MIB::tpl2BridgeManagePortIndex.49153 = STRING: 1/0/1
|
||||
// TPLINK-L2BRIDGE-MIB::tpl2BridgeManagePortIndex.49154 = STRING: 1/0/2
|
||||
$fdb_ports = [];
|
||||
foreach (snmpwalk_cache_oid($device, 'tpl2BridgeManagePortIndex', [], 'TPLINK-L2BRIDGE-MIB') as $ifIndex => $entry) {
|
||||
$fdb_ports[$entry['tpl2BridgeManagePortIndex']] = $ifIndex;
|
||||
$fdb_ports[$entry['tpl2BridgeManagePortIndex']] = $ifIndex;
|
||||
}
|
||||
if (!snmp_status()) {
|
||||
return;
|
||||
}
|
||||
if (!snmp_status()) { return; }
|
||||
|
||||
// TPLINK-L2BRIDGE-MIB::tpl2BridgeManageDynMac.20.88.208.75.9.0.10 = STRING: "14-58-d0-4b-09-00"
|
||||
// TPLINK-L2BRIDGE-MIB::tpl2BridgeManageDynMac.20.88.208.75.9.0.744 = STRING: "14-58-d0-4b-09-00"
|
||||
@ -32,29 +36,31 @@ if (!snmp_status()) { return; }
|
||||
// TPLINK-L2BRIDGE-MIB::tpl2BridgeManageDynStatus.20.88.208.75.9.0.10 = INTEGER: active(1)
|
||||
// TPLINK-L2BRIDGE-MIB::tpl2BridgeManageDynStatus.20.88.208.75.9.0.744 = INTEGER: active(1)
|
||||
foreach (snmpwalk_cache_oid($device, 'tpl2BridgeManageDynAddrCtrlTable', [], 'TPLINK-L2BRIDGE-MIB', NULL, OBS_SNMP_ALL_NUMERIC_INDEX) as $index => $entry) {
|
||||
if ($entry['tpl2BridgeManageDynAgeStatus'] !== 'aging') { continue; }
|
||||
if (!isset($fdb_ports[$entry['tpl2BridgeManageDynPort']])) {
|
||||
print_debug("Unknown port '".$entry['tpl2BridgeManageDynPort']."'.");
|
||||
print_debug_vars($entry);
|
||||
continue;
|
||||
}
|
||||
if ($entry['tpl2BridgeManageDynAgeStatus'] !== 'aging') {
|
||||
continue;
|
||||
}
|
||||
if (!isset($fdb_ports[$entry['tpl2BridgeManageDynPort']])) {
|
||||
print_debug("Unknown port '" . $entry['tpl2BridgeManageDynPort'] . "'.");
|
||||
print_debug_vars($entry);
|
||||
continue;
|
||||
}
|
||||
|
||||
$ifIndex = $fdb_ports[$entry['tpl2BridgeManageDynPort']];
|
||||
$vlan = $entry['tpl2BridgeManageDynVlanId'];
|
||||
$ifIndex = $fdb_ports[$entry['tpl2BridgeManageDynPort']];
|
||||
$vlan = $entry['tpl2BridgeManageDynVlanId'];
|
||||
|
||||
// Make sure the ifIndex is actually valid
|
||||
if ($ifIndex != 0 && is_array($port_ifIndex_table[$ifIndex])) {
|
||||
$port = $port_ifIndex_table[$ifIndex];
|
||||
$mac = mac_zeropad($entry['tpl2BridgeManageDynMac']);
|
||||
// Make sure the ifIndex is actually valid
|
||||
if ($ifIndex != 0 && is_array($port_ifIndex_table[$ifIndex])) {
|
||||
$port = $port_ifIndex_table[$ifIndex];
|
||||
$mac = mac_zeropad($entry['tpl2BridgeManageDynMac']);
|
||||
|
||||
$data = [];
|
||||
$data = [];
|
||||
|
||||
$data['port_id'] = $port['port_id'];
|
||||
$data['port_index'] = $ifIndex;
|
||||
$data['fdb_status'] = 'learned'; // Hardcoded for this MIB
|
||||
$data['port_id'] = $port['port_id'];
|
||||
$data['port_index'] = $ifIndex;
|
||||
$data['fdb_status'] = 'learned'; // Hardcoded for this MIB
|
||||
|
||||
$fdbs[$vlan][$mac] = $data;
|
||||
}
|
||||
$fdbs[$vlan][$mac] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
Reference in New Issue
Block a user