Commit version 24.12.13800
This commit is contained in:
@ -4,9 +4,9 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
@ -78,52 +78,52 @@ CORIANT-GROOVE-MIB::eth100gStatisticsEntryOutPackets256to511octets.1.1.0.6.0 = S
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryOutPackets512to1023octets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryOutPackets1024to1518octets.1.1.0.6.0 = STRING: "0"
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
$mib = 'CORIANT-GROOVE-MIB';
|
||||
|
||||
// this is eth100g only, note that fc8gTable, fc16gTable, eth10gTable, eth40gTable, eth400gtable all exist too!
|
||||
// this is eth100g only, note that fc8gTable, fc16gTable, eth10gTable, eth40gTable, eth400gtable all exist too!
|
||||
|
||||
//eth100gTable
|
||||
$entries = [];
|
||||
$entries = snmpwalk_cache_oid($device, 'eth100gTable', $entries, $mib);
|
||||
//eth100gTable
|
||||
$entries = [];
|
||||
$entries = snmpwalk_cache_oid($device, 'eth100gTable', $entries, $mib);
|
||||
|
||||
print_debug_vars($entries);
|
||||
|
||||
foreach ($entries as $port_oid_suffix => $port) {
|
||||
print_debug_vars($entries);
|
||||
|
||||
foreach ($entries as $port_oid_suffix => $port) {
|
||||
$ifIndex = $port_oid_suffix;
|
||||
|
||||
// basics
|
||||
$port_stats[$ifIndex]['ifDescr'] = $port['eth100gAliasName'];
|
||||
$port_stats[$ifIndex]['ifName'] = $port['eth100gAliasName'];
|
||||
$port_stats[$ifIndex]['ifAlias'] = $port['eth100gServiceLabel'];
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = $port['eth100gOperStatus'];
|
||||
$port_stats[$ifIndex]['ifAdminStatus'] = $port['eth100gAdminStatus'];
|
||||
$port_stats[$ifIndex]['ifType'] = 'ethernetCsmacd'; // can we do better than hard coding?
|
||||
$port_stats[$ifIndex]['ifDescr'] = $port['eth100gAliasName'];
|
||||
$port_stats[$ifIndex]['ifName'] = $port['eth100gAliasName'];
|
||||
$port_stats[$ifIndex]['ifAlias'] = $port['eth100gServiceLabel'];
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = $port['eth100gOperStatus'];
|
||||
$port_stats[$ifIndex]['ifAdminStatus'] = $port['eth100gAdminStatus'];
|
||||
$port_stats[$ifIndex]['ifType'] = 'ethernetCsmacd'; // can we do better than hard coding?
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// eth400gtable
|
||||
$entries = [];
|
||||
$entries = snmpwalk_cache_oid($device, 'eth400gTable', $entries, $mib);
|
||||
// eth400gtable
|
||||
$entries = [];
|
||||
$entries = snmpwalk_cache_oid($device, 'eth400gTable', $entries, $mib);
|
||||
|
||||
print_debug_vars($entries);
|
||||
|
||||
foreach ($entries as $port_oid_suffix => $port) {
|
||||
print_debug_vars($entries);
|
||||
|
||||
foreach ($entries as $port_oid_suffix => $port) {
|
||||
$ifIndex = $port_oid_suffix;
|
||||
|
||||
// basics
|
||||
$port_stats[$ifIndex]['ifDescr'] = $port['eth400gAliasName'];
|
||||
$port_stats[$ifIndex]['ifName'] = $port['eth400gAliasName'];
|
||||
$port_stats[$ifIndex]['ifAlias'] = $port['eth400gServiceLabel'];
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = $port['eth400gOperStatus'];
|
||||
$port_stats[$ifIndex]['ifAdminStatus'] = $port['eth400gAdminStatus'];
|
||||
$port_stats[$ifIndex]['ifType'] = 'ethernetCsmacd'; // can we do better than hard coding?
|
||||
$port_stats[$ifIndex]['ifDescr'] = $port['eth400gAliasName'];
|
||||
$port_stats[$ifIndex]['ifName'] = $port['eth400gAliasName'];
|
||||
$port_stats[$ifIndex]['ifAlias'] = $port['eth400gServiceLabel'];
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = $port['eth400gOperStatus'];
|
||||
$port_stats[$ifIndex]['ifAdminStatus'] = $port['eth400gAdminStatus'];
|
||||
$port_stats[$ifIndex]['ifType'] = 'ethernetCsmacd'; // can we do better than hard coding?
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print_debug_vars($port_stats);
|
||||
print_debug_vars($port_stats);
|
||||
|
||||
|
||||
// EOF
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage poller
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage poller
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage poller
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage poller
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
@ -14,141 +14,140 @@
|
||||
|
||||
$index = array_key_first($port_stats);
|
||||
if (!isset($port_stats[$index]['ifType'])) {
|
||||
// Ethernet ports:
|
||||
// Ethernet ports:
|
||||
|
||||
// IPE-SYSTEM-MIB::ipeCfgPortEtherEnable.31 = INTEGER: enabled(1)
|
||||
// IPE-SYSTEM-MIB::ipeCfgPortEtherAutoNeg.31 = INTEGER: enabled(1)
|
||||
// IPE-SYSTEM-MIB::ipeCfgPortEtherSpecialFilter.31 = INTEGER: false(2)
|
||||
// IPE-SYSTEM-MIB::ipeCfgPortEtherLldpMode.31 = INTEGER: standardMode(1)
|
||||
// IPE-SYSTEM-MIB::ipeCfgPortEtherEntry.7.31 = INTEGER: 1
|
||||
// IPE-SYSTEM-MIB::ipeCfgPortEtherEnable.31 = INTEGER: enabled(1)
|
||||
// IPE-SYSTEM-MIB::ipeCfgPortEtherAutoNeg.31 = INTEGER: enabled(1)
|
||||
// IPE-SYSTEM-MIB::ipeCfgPortEtherSpecialFilter.31 = INTEGER: false(2)
|
||||
// IPE-SYSTEM-MIB::ipeCfgPortEtherLldpMode.31 = INTEGER: standardMode(1)
|
||||
// IPE-SYSTEM-MIB::ipeCfgPortEtherEntry.7.31 = INTEGER: 1
|
||||
|
||||
// IPE-SYSTEM-MIB::ipeStsPortEtherLinkUp.31 = INTEGER: 1
|
||||
// IPE-SYSTEM-MIB::ipeStsPortEtherSpeed.31 = INTEGER: 100
|
||||
// IPE-SYSTEM-MIB::ipeStsPortEtherDuplex.31 = INTEGER: 2
|
||||
// IPE-SYSTEM-MIB::ipeStsPortEtherFlowControl.31 = INTEGER: 0
|
||||
// IPE-SYSTEM-MIB::ipeStsPortEtherLinkUp.31 = INTEGER: 1
|
||||
// IPE-SYSTEM-MIB::ipeStsPortEtherSpeed.31 = INTEGER: 100
|
||||
// IPE-SYSTEM-MIB::ipeStsPortEtherDuplex.31 = INTEGER: 2
|
||||
// IPE-SYSTEM-MIB::ipeStsPortEtherFlowControl.31 = INTEGER: 0
|
||||
|
||||
// IPE-COMMON-MIB::invMacAddress.31 = STRING: 74:3a:65:5d:b6:c0
|
||||
// IPE-COMMON-MIB::invMacAddress.31 = STRING: 74:3a:65:5d:b6:c0
|
||||
|
||||
// ODU ports:
|
||||
// IPE-COMMON-MIB::lof.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::frameID.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::highBERAlarm.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::lowBERAlarm.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::earlyWarningAlarm.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::modAlarm.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::ifCableShortAlarm.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::atpcPowerMode.16842752 = INTEGER: active(2)
|
||||
// IPE-COMMON-MIB::inPhaseStatus.16842752 = INTEGER: outphase(2)
|
||||
// IPE-COMMON-MIB::amrRangeMismatch.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::txModulation.16842752 = INTEGER: qpsk(1)
|
||||
// IPE-COMMON-MIB::rxModulation.16842752 = INTEGER: qpsk(1)
|
||||
// IPE-COMMON-MIB::l2SyncLossAlarm.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::rdiAlarm.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::uaeAlarm.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::unlocked.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::tempAlarm.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::tdmRangeMismatch.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::modemPsOff.16842752 = INTEGER: on(2)
|
||||
// ODU ports:
|
||||
// IPE-COMMON-MIB::lof.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::frameID.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::highBERAlarm.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::lowBERAlarm.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::earlyWarningAlarm.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::modAlarm.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::ifCableShortAlarm.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::atpcPowerMode.16842752 = INTEGER: active(2)
|
||||
// IPE-COMMON-MIB::inPhaseStatus.16842752 = INTEGER: outphase(2)
|
||||
// IPE-COMMON-MIB::amrRangeMismatch.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::txModulation.16842752 = INTEGER: qpsk(1)
|
||||
// IPE-COMMON-MIB::rxModulation.16842752 = INTEGER: qpsk(1)
|
||||
// IPE-COMMON-MIB::l2SyncLossAlarm.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::rdiAlarm.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::uaeAlarm.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::unlocked.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::tempAlarm.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::tdmRangeMismatch.16842752 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::modemPsOff.16842752 = INTEGER: on(2)
|
||||
|
||||
// SFP ports
|
||||
// IPE-COMMON-MIB::asETHPortInterfaceType.142802944 = INTEGER: invalid(0)
|
||||
// IPE-COMMON-MIB::asETHPortSpeedDuplex.142802944 = INTEGER: invalid(0)
|
||||
// IPE-COMMON-MIB::asETHPortFlowControl.142802944 = INTEGER: disable(1)
|
||||
// IPE-COMMON-MIB::asETHPortMDIMDIX.142802944 = INTEGER: invalid(0)
|
||||
// IPE-COMMON-MIB::asETHPortLinkStatus.142802944 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::asETHPortAdminStatus.142802944 = INTEGER: normal(1)
|
||||
// IPE-COMMON-MIB::asETHPortSFPEquip.142802944 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::asETHPortSFPLos.142802944 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::asETHPortSFPTxError.142802944 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::asETHPortSFPTypeMismatch.142802944 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::asETHPortOperStatus.142802944 = INTEGER: linkDown(1)
|
||||
// IPE-COMMON-MIB::asETHPortLlfOamReceived.142802944 = INTEGER: normal(1)
|
||||
// SFP ports
|
||||
// IPE-COMMON-MIB::asETHPortInterfaceType.142802944 = INTEGER: invalid(0)
|
||||
// IPE-COMMON-MIB::asETHPortSpeedDuplex.142802944 = INTEGER: invalid(0)
|
||||
// IPE-COMMON-MIB::asETHPortFlowControl.142802944 = INTEGER: disable(1)
|
||||
// IPE-COMMON-MIB::asETHPortMDIMDIX.142802944 = INTEGER: invalid(0)
|
||||
// IPE-COMMON-MIB::asETHPortLinkStatus.142802944 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::asETHPortAdminStatus.142802944 = INTEGER: normal(1)
|
||||
// IPE-COMMON-MIB::asETHPortSFPEquip.142802944 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::asETHPortSFPLos.142802944 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::asETHPortSFPTxError.142802944 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::asETHPortSFPTypeMismatch.142802944 = INTEGER: cleared(1)
|
||||
// IPE-COMMON-MIB::asETHPortOperStatus.142802944 = INTEGER: linkDown(1)
|
||||
// IPE-COMMON-MIB::asETHPortLlfOamReceived.142802944 = INTEGER: normal(1)
|
||||
|
||||
$entries = [];
|
||||
//$entries = snmpwalk_cache_oid($device, 'ipeCfgPortEtherEnable', $entries, 'IPE-SYSTEM-MIB');
|
||||
$entries = snmpwalk_cache_oid($device, 'ipeCfgPortModemEnable', $entries, 'IPE-SYSTEM-MIB');
|
||||
$entries = snmpwalk_cache_oid($device, 'ipeStsPortEtherLinkUp', $entries, 'IPE-SYSTEM-MIB');
|
||||
//$entries = snmpwalk_cache_oid($device, 'ipeStsPortEtherDuplex', $entries, 'IPE-SYSTEM-MIB');
|
||||
$entries = snmpwalk_cache_oid($device, 'invMacAddress', $entries, 'IPE-COMMON-MIB');
|
||||
$entries = [];
|
||||
//$entries = snmpwalk_cache_oid($device, 'ipeCfgPortEtherEnable', $entries, 'IPE-SYSTEM-MIB');
|
||||
$entries = snmpwalk_cache_oid($device, 'ipeCfgPortModemEnable', $entries, 'IPE-SYSTEM-MIB');
|
||||
$entries = snmpwalk_cache_oid($device, 'ipeStsPortEtherLinkUp', $entries, 'IPE-SYSTEM-MIB');
|
||||
//$entries = snmpwalk_cache_oid($device, 'ipeStsPortEtherDuplex', $entries, 'IPE-SYSTEM-MIB');
|
||||
$entries = snmpwalk_cache_oid($device, 'invMacAddress', $entries, 'IPE-COMMON-MIB');
|
||||
|
||||
$entries = snmpwalk_cache_oid($device, 'atpcPowerMode', $entries, 'IPE-COMMON-MIB');
|
||||
$entries = snmpwalk_cache_oid($device, 'atpcPowerMode', $entries, 'IPE-COMMON-MIB');
|
||||
|
||||
$entries = snmpwalk_cache_oid($device, 'asETHPortInterfaceType', $entries, 'IPE-COMMON-MIB');
|
||||
$entries = snmpwalk_cache_oid($device, 'asETHPortOperStatus', $entries, 'IPE-COMMON-MIB');
|
||||
print_debug_vars($entries);
|
||||
$entries = snmpwalk_cache_oid($device, 'asETHPortInterfaceType', $entries, 'IPE-COMMON-MIB');
|
||||
$entries = snmpwalk_cache_oid($device, 'asETHPortOperStatus', $entries, 'IPE-COMMON-MIB');
|
||||
print_debug_vars($entries);
|
||||
|
||||
foreach ($port_stats as $ifIndex => $port)
|
||||
{
|
||||
$entry = isset($entries[$ifIndex]) ? $entries[$ifIndex] : [];
|
||||
foreach ($port_stats as $ifIndex => $port) {
|
||||
$entry = isset($entries[$ifIndex]) ? $entries[$ifIndex] : [];
|
||||
|
||||
// ifType
|
||||
if (isset($entry['ipeStsPortEtherLinkUp'], $entry['invMacAddress']) ||
|
||||
str_starts($port['ifName'], [ 'eth', 'bcm' ])) {
|
||||
$port_stats[$ifIndex]['ifType'] = 'ethernetCsmacd';
|
||||
} elseif (isset($entry['asETHPortInterfaceType'])) {
|
||||
switch ($entry['ipeStsPortEtherDuplex']) {
|
||||
case 'fiber':
|
||||
$port_stats[$ifIndex]['ifType'] = 'opticalChannel'; // ??
|
||||
break;
|
||||
// ifType
|
||||
if (isset($entry['ipeStsPortEtherLinkUp'], $entry['invMacAddress']) ||
|
||||
str_starts($port['ifName'], ['eth', 'bcm'])) {
|
||||
$port_stats[$ifIndex]['ifType'] = 'ethernetCsmacd';
|
||||
} elseif (isset($entry['asETHPortInterfaceType'])) {
|
||||
switch ($entry['ipeStsPortEtherDuplex']) {
|
||||
case 'fiber':
|
||||
$port_stats[$ifIndex]['ifType'] = 'opticalChannel'; // ??
|
||||
break;
|
||||
|
||||
case 'copper':
|
||||
$port_stats[$ifIndex]['ifType'] = 'ethernetCsmacd';
|
||||
break;
|
||||
case 'copper':
|
||||
$port_stats[$ifIndex]['ifType'] = 'ethernetCsmacd';
|
||||
break;
|
||||
|
||||
default:
|
||||
$port_stats[$ifIndex]['ifType'] = 'other';
|
||||
}
|
||||
} elseif (str_starts($port['ifName'], 'lo')) {
|
||||
$port_stats[$ifIndex]['ifType'] = 'softwareLoopback';
|
||||
} elseif (isset($entry['atpcPowerMode'])) {
|
||||
$port_stats[$ifIndex]['ifType'] = 'otnOdu'; // ??
|
||||
} elseif (!str_starts($port['ifName'], 'lldp')) {
|
||||
$port_stats[$ifIndex]['ifType'] = 'other';
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
// ifOperStatus
|
||||
if (isset($entry['ipeStsPortEtherLinkUp'])) {
|
||||
switch ($entry['ipeStsPortEtherLinkUp']) {
|
||||
case '1':
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = 'up';
|
||||
break;
|
||||
|
||||
case '2':
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = 'down';
|
||||
break;
|
||||
|
||||
default:
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = 'unknown';
|
||||
}
|
||||
} elseif (isset($entry['asETHPortOperStatus'])) {
|
||||
switch ($entry['asETHPortOperStatus']) {
|
||||
case 'linkDown':
|
||||
case '1':
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = 'down';
|
||||
break;
|
||||
|
||||
case 'linkUp':
|
||||
case '2':
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = 'up';
|
||||
break;
|
||||
|
||||
default:
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = 'unknown';
|
||||
}
|
||||
} elseif (isset($entry['ipeCfgPortModemEnable'])) {
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = $entry['ipeCfgPortModemEnable'] === 'enabled' ? 'up' : 'down';
|
||||
} elseif (str_starts($port['ifName'], 'lo')) {
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = 'up';
|
||||
} elseif (isset($entry['atpcPowerMode'])) {
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = $entry['atpcPowerMode'] === 'active' ? 'up' : 'down';
|
||||
} else {
|
||||
// Force unknown
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = 'unknown';
|
||||
}
|
||||
|
||||
default:
|
||||
$port_stats[$ifIndex]['ifType'] = 'other';
|
||||
}
|
||||
} elseif (str_starts($port['ifName'], 'lo')) {
|
||||
$port_stats[$ifIndex]['ifType'] = 'softwareLoopback';
|
||||
} elseif (isset($entry['atpcPowerMode'])) {
|
||||
$port_stats[$ifIndex]['ifType'] = 'otnOdu'; // ??
|
||||
} elseif (!str_starts($port['ifName'], 'lldp')) {
|
||||
$port_stats[$ifIndex]['ifType'] = 'other';
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
// ifOperStatus
|
||||
if (isset($entry['ipeStsPortEtherLinkUp'])) {
|
||||
switch ($entry['ipeStsPortEtherLinkUp']) {
|
||||
case '1':
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = 'up';
|
||||
break;
|
||||
|
||||
case '2':
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = 'down';
|
||||
break;
|
||||
|
||||
default:
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = 'unknown';
|
||||
}
|
||||
} elseif (isset($entry['asETHPortOperStatus'])) {
|
||||
switch ($entry['asETHPortOperStatus']) {
|
||||
case 'linkDown':
|
||||
case '1':
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = 'down';
|
||||
break;
|
||||
|
||||
case 'linkUp':
|
||||
case '2':
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = 'up';
|
||||
break;
|
||||
|
||||
default:
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = 'unknown';
|
||||
}
|
||||
} elseif (isset($entry['ipeCfgPortModemEnable'])) {
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = $entry['ipeCfgPortModemEnable'] === 'enabled' ? 'up' : 'down';
|
||||
} elseif (str_starts($port['ifName'], 'lo')) {
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = 'up';
|
||||
} elseif (isset($entry['atpcPowerMode'])) {
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = $entry['atpcPowerMode'] === 'active' ? 'up' : 'down';
|
||||
} else {
|
||||
// Force unknown
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = 'unknown';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
@ -92,9 +92,8 @@
|
||||
|
||||
$jnxVirtualChassisMember = snmp_cache_table($device, 'jnxVirtualChassisMemberTable', [], 'JUNIPER-VIRTUALCHASSIS-MIB');
|
||||
print_debug_vars($jnxVirtualChassisMember);
|
||||
if (!snmp_status() || count($jnxVirtualChassisMember) < 1)
|
||||
{
|
||||
return;
|
||||
if (!snmp_status() || count($jnxVirtualChassisMember) < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
//$jnxVirtualChassisPort = snmpwalk_cache_twopart_oid($device, 'jnxVirtualChassisPortTable', [], 'JUNIPER-VIRTUALCHASSIS-MIB', NULL, OBS_SNMP_ALL_MULTILINE);
|
||||
@ -103,32 +102,29 @@ if (!snmp_status() || count($jnxVirtualChassisMember) < 1)
|
||||
//$mib_config = &$config['mibs'][$mib]['ports']['oids']; // Attach MIB options/translations
|
||||
//print_debug_vars($mib_config);
|
||||
|
||||
foreach ($jnxVirtualChassisMember as $member => $chassis)
|
||||
{
|
||||
if ($chassis['jnxVirtualChassisMemberRole'] === 'master')
|
||||
{
|
||||
// Skip master chassis (which already polled by IF-MIB)
|
||||
print_debug("Skip JUNIPER-VIRTUALCHASSIS-MIB::jnxVirtualChassisPortTable for master");
|
||||
continue;
|
||||
}
|
||||
foreach ($jnxVirtualChassisMember as $member => $chassis) {
|
||||
if ($chassis['jnxVirtualChassisMemberRole'] === 'master') {
|
||||
// Skip master chassis (which already polled by IF-MIB)
|
||||
print_debug("Skip JUNIPER-VIRTUALCHASSIS-MIB::jnxVirtualChassisPortTable for master");
|
||||
continue;
|
||||
}
|
||||
|
||||
$jnxVirtualChassisPort = snmpwalk_cache_twopart_oid($device, 'jnxVirtualChassisPortOperStatus.'.$member, [], 'JUNIPER-VIRTUALCHASSIS-MIB', NULL, OBS_SNMP_ALL_MULTILINE);
|
||||
print_debug_vars($jnxVirtualChassisPort);
|
||||
$jnxVirtualChassisPort = snmpwalk_cache_twopart_oid($device, 'jnxVirtualChassisPortOperStatus.' . $member, [], 'JUNIPER-VIRTUALCHASSIS-MIB', NULL, OBS_SNMP_ALL_MULTILINE);
|
||||
print_debug_vars($jnxVirtualChassisPort);
|
||||
|
||||
foreach ($jnxVirtualChassisPort[$member] as $jnxVirtualChassisPortName => $port)
|
||||
{
|
||||
$ifDescr = $jnxVirtualChassisPortName . ":vc$member";
|
||||
// Generate numeric ifIndex based on port name
|
||||
$ifIndex = string_to_id($ifDescr);
|
||||
foreach ($jnxVirtualChassisPort[$member] as $jnxVirtualChassisPortName => $port) {
|
||||
$ifDescr = $jnxVirtualChassisPortName . ":vc$member";
|
||||
// Generate numeric ifIndex based on port name
|
||||
$ifIndex = string_to_id($ifDescr);
|
||||
|
||||
// Append member options
|
||||
$port = array_merge($port, $chassis);
|
||||
// Append member options
|
||||
$port = array_merge($port, $chassis);
|
||||
|
||||
$port_stats[$ifIndex]['ifDescr'] = $ifDescr;
|
||||
$port_stats[$ifIndex]['ifName'] = $ifDescr;
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = $port['jnxVirtualChassisPortOperStatus'];
|
||||
$port_stats[$ifIndex]['ifType'] = str_contains($ifDescr, '.') ? 'propVirtual' : 'other';
|
||||
}
|
||||
$port_stats[$ifIndex]['ifDescr'] = $ifDescr;
|
||||
$port_stats[$ifIndex]['ifName'] = $ifDescr;
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = $port['jnxVirtualChassisPortOperStatus'];
|
||||
$port_stats[$ifIndex]['ifType'] = str_contains($ifDescr, '.') ? 'propVirtual' : 'other';
|
||||
}
|
||||
}
|
||||
|
||||
// EOF
|
||||
@ -6,70 +6,70 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
// NETAPP-MIB
|
||||
|
||||
if (safe_empty($port_stats)) {
|
||||
// If not has standard IF-MIB table, use NETAPP specific tables
|
||||
$mib = 'NETAPP-MIB';
|
||||
// If not has standard IF-MIB table, use NETAPP specific tables
|
||||
$mib = 'NETAPP-MIB';
|
||||
|
||||
//NETAPP-MIB::netifDescr.11 = STRING: "vega-01:MGMT_PORT_ONLY e0P"
|
||||
//NETAPP-MIB::netifDescr.12 = STRING: "vega-01:MGMT_PORT_ONLY e0M"
|
||||
//NETAPP-MIB::netifDescr.15 = STRING: "vega-01:a0m"
|
||||
//NETAPP-MIB::netifDescr.16 = STRING: "vega-01:a0m-40"
|
||||
print_cli($mib.'::netifDescr ');
|
||||
$netif_stat = snmpwalk_cache_oid($device, 'netifDescr', array(), $mib);
|
||||
print_debug_vars($netif_stat);
|
||||
//NETAPP-MIB::netifDescr.11 = STRING: "vega-01:MGMT_PORT_ONLY e0P"
|
||||
//NETAPP-MIB::netifDescr.12 = STRING: "vega-01:MGMT_PORT_ONLY e0M"
|
||||
//NETAPP-MIB::netifDescr.15 = STRING: "vega-01:a0m"
|
||||
//NETAPP-MIB::netifDescr.16 = STRING: "vega-01:a0m-40"
|
||||
print_cli($mib . '::netifDescr ');
|
||||
$netif_stat = snmpwalk_cache_oid($device, 'netifDescr', [], $mib);
|
||||
print_debug_vars($netif_stat);
|
||||
|
||||
$flags = OBS_SNMP_ALL ^ OBS_QUOTES_STRIP;
|
||||
$netport_stat = snmpwalk_cache_twopart_oid($device, 'netportLinkState', array(), $mib, NULL, $flags);
|
||||
print_cli($mib.'::netportLinkState ');
|
||||
$netport_stat = snmpwalk_cache_twopart_oid($device, 'netportType', $netport_stat, $mib, NULL, $flags);
|
||||
print_cli($mib.'::netportType ');
|
||||
print_debug_vars($netport_stat);
|
||||
$flags = OBS_SNMP_ALL ^ OBS_QUOTES_STRIP;
|
||||
$netport_stat = snmpwalk_cache_twopart_oid($device, 'netportLinkState', [], $mib, NULL, $flags);
|
||||
print_cli($mib . '::netportLinkState ');
|
||||
$netport_stat = snmpwalk_cache_twopart_oid($device, 'netportType', $netport_stat, $mib, NULL, $flags);
|
||||
print_cli($mib . '::netportType ');
|
||||
print_debug_vars($netport_stat);
|
||||
|
||||
$mib_def = &$config['mibs'][$mib]['ports']['oids']; // Attach MIB options/translations
|
||||
//print_vars($mib_def);
|
||||
$mib_def = &$config['mibs'][$mib]['ports']['oids']; // Attach MIB options/translations
|
||||
//print_vars($mib_def);
|
||||
|
||||
// Now rewrite to standard IF-MIB array
|
||||
foreach ($netif_stat as $ifIndex => $port) {
|
||||
if (str_contains($port['netifDescr'], ':')) {
|
||||
list($port['netportNode'], $port['netportPort']) = explode(':', $port['netifDescr'], 2);
|
||||
} else {
|
||||
$port['netportNode'] = '';
|
||||
$port['netportPort'] = $port['netifDescr'];
|
||||
}
|
||||
$port['netportPort'] = str_ireplace('MGMT_PORT_ONLY ', '', $port['netportPort']);
|
||||
|
||||
if (isset($netport_stat[$port['netportNode']][$port['netportPort']])) {
|
||||
// ifDescr
|
||||
$oid = 'ifDescr';
|
||||
$port[$oid] = $port[$mib_def[$oid]['oid']];
|
||||
$port_stats[$ifIndex][$oid] = $port[$oid];
|
||||
|
||||
// ifName, ifAlias
|
||||
$port_stats[$ifIndex]['ifName'] = strlen($port['netportNode']) ? $port['netportNode'].':'.$port['netportPort'] : $port['netportPort'];
|
||||
$port_stats[$ifIndex]['ifAlias'] = ''; // FIXME, I not found
|
||||
|
||||
$netport = &$netport_stat[$port['netportNode']][$port['netportPort']];
|
||||
|
||||
// ifType, ifOperStatus
|
||||
foreach (array('ifType', 'ifOperStatus') as $oid) {
|
||||
$port[$oid] = $netport[$mib_def[$oid]['oid']];
|
||||
if (isset($mib_def[$oid]['transform'])) {
|
||||
// Translate to standard IF-MIB values
|
||||
$port[$oid] = string_transform($port[$oid], $mib_def[$oid]['transform']);
|
||||
// Now rewrite to standard IF-MIB array
|
||||
foreach ($netif_stat as $ifIndex => $port) {
|
||||
if (str_contains($port['netifDescr'], ':')) {
|
||||
[$port['netportNode'], $port['netportPort']] = explode(':', $port['netifDescr'], 2);
|
||||
} else {
|
||||
$port['netportNode'] = '';
|
||||
$port['netportPort'] = $port['netifDescr'];
|
||||
}
|
||||
$port_stats[$ifIndex][$oid] = $port[$oid];
|
||||
}
|
||||
}
|
||||
}
|
||||
//if (OBS_DEBUG > 1 && count($port_stats)) { print_vars($port_stats); }
|
||||
$port['netportPort'] = str_ireplace('MGMT_PORT_ONLY ', '', $port['netportPort']);
|
||||
|
||||
unset($netif_stat, $netport_stat, $netport, $flags, $ifIndex, $port);
|
||||
if (isset($netport_stat[$port['netportNode']][$port['netportPort']])) {
|
||||
// ifDescr
|
||||
$oid = 'ifDescr';
|
||||
$port[$oid] = $port[$mib_def[$oid]['oid']];
|
||||
$port_stats[$ifIndex][$oid] = $port[$oid];
|
||||
|
||||
// ifName, ifAlias
|
||||
$port_stats[$ifIndex]['ifName'] = strlen($port['netportNode']) ? $port['netportNode'] . ':' . $port['netportPort'] : $port['netportPort'];
|
||||
$port_stats[$ifIndex]['ifAlias'] = ''; // FIXME, I not found
|
||||
|
||||
$netport = &$netport_stat[$port['netportNode']][$port['netportPort']];
|
||||
|
||||
// ifType, ifOperStatus
|
||||
foreach (['ifType', 'ifOperStatus'] as $oid) {
|
||||
$port[$oid] = $netport[$mib_def[$oid]['oid']];
|
||||
if (isset($mib_def[$oid]['transform'])) {
|
||||
// Translate to standard IF-MIB values
|
||||
$port[$oid] = string_transform($port[$oid], $mib_def[$oid]['transform']);
|
||||
}
|
||||
$port_stats[$ifIndex][$oid] = $port[$oid];
|
||||
}
|
||||
}
|
||||
}
|
||||
//if (OBS_DEBUG > 1 && count($port_stats)) { print_vars($port_stats); }
|
||||
|
||||
unset($netif_stat, $netport_stat, $netport, $flags, $ifIndex, $port);
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage poller
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
|
||||
* @subpackage discovery
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
@ -14,55 +14,53 @@
|
||||
/// but only informational fields (without stats)
|
||||
|
||||
// Try Ports in VRF SNMP contexts
|
||||
if (safe_empty($device['snmp_context']) && // Device not already with context
|
||||
isset($config['os'][$device['os']]['snmp']['virtual']) && $config['os'][$device['os']]['snmp']['virtual'] && // Context permitted for os
|
||||
$vrf_contexts = safe_json_decode(get_entity_attrib('device', $device, 'vrf_contexts'))) { // SNMP VRF context discovered for device
|
||||
// Keep original device array
|
||||
$device_original = $device;
|
||||
$vrf_ports = [];
|
||||
if ($vrf_contexts = get_device_vrf_contexts($device)) { // SNMP VRF context discovered for device
|
||||
// Keep original device array
|
||||
$device_original = $device;
|
||||
$vrf_ports = [];
|
||||
|
||||
$data_oids_vrf = [
|
||||
//'ifDescr',
|
||||
'ifType', 'ifOperStatus', 'ifName', 'ifAlias'
|
||||
];
|
||||
$data_oids_vrf = [
|
||||
//'ifDescr',
|
||||
'ifType', 'ifOperStatus', 'ifName', 'ifAlias'
|
||||
];
|
||||
|
||||
foreach ($vrf_contexts as $vrf_name => $snmp_context) {
|
||||
print_message("Ports in VRF: $vrf_name...");
|
||||
foreach ($vrf_contexts as $vrf_name => $snmp_context) {
|
||||
print_message("Ports in VRF: $vrf_name...");
|
||||
|
||||
$device['snmp_context'] = $snmp_context;
|
||||
$device['snmp_context'] = $snmp_context;
|
||||
|
||||
// Get ifDescr and validate if has unique ifIndexes
|
||||
$port_stats_vrf = snmpwalk_cache_oid($device, 'ifDescr', [], "IF-MIB");
|
||||
// Get ifDescr and validate if has unique ifIndexes
|
||||
$port_stats_vrf = snmpwalk_cache_oid($device, 'ifDescr', [], "IF-MIB");
|
||||
|
||||
$has_unique_ports = FALSE;
|
||||
foreach ($port_stats_vrf as $ifIndex => $entry) {
|
||||
if (!isset($port_stats[$ifIndex])) {
|
||||
$has_unique_ports = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Walk all other data Oids and merge with main stats
|
||||
if ($has_unique_ports) {
|
||||
foreach ($data_oids_vrf as $oid) {
|
||||
$port_stats_vrf = snmpwalk_cache_oid($device, $oid, $port_stats_vrf, "IF-MIB");
|
||||
}
|
||||
|
||||
foreach ($port_stats_vrf as $ifIndex => $entry) {
|
||||
// Merge stats
|
||||
if (!isset($port_stats[$ifIndex])) {
|
||||
$entry['vrf_name'] = $vrf_name;
|
||||
$port_stats[$ifIndex] = $entry;
|
||||
$vrf_ports[$vrf_name][$ifIndex] = $entry;
|
||||
$has_unique_ports = FALSE;
|
||||
foreach ($port_stats_vrf as $ifIndex => $entry) {
|
||||
if (!isset($port_stats[$ifIndex])) {
|
||||
$has_unique_ports = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
print_debug_vars($vrf_ports);
|
||||
|
||||
// Clean
|
||||
$device = $device_original;
|
||||
unset($device_original, $vrf_ports, $port_stats_vrf);
|
||||
// Walk all other data Oids and merge with main stats
|
||||
if ($has_unique_ports) {
|
||||
foreach ($data_oids_vrf as $oid) {
|
||||
$port_stats_vrf = snmpwalk_cache_oid($device, $oid, $port_stats_vrf, "IF-MIB");
|
||||
}
|
||||
|
||||
foreach ($port_stats_vrf as $ifIndex => $entry) {
|
||||
// Merge stats
|
||||
if (!isset($port_stats[$ifIndex])) {
|
||||
$entry['vrf_name'] = $vrf_name;
|
||||
$port_stats[$ifIndex] = $entry;
|
||||
$vrf_ports[$vrf_name][$ifIndex] = $entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
print_debug_vars($vrf_ports);
|
||||
|
||||
// Clean
|
||||
$device = $device_original;
|
||||
unset($device_original, $vrf_ports, $port_stats_vrf);
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
||||
Reference in New Issue
Block a user