newdevice: Added support for multi-lane optics on Juniper equipment (#6377)

* I agree to the conditions of the Contributor Agreement contained in doc/General/Contributing.md.

* Poll device for optic lane info

* Add discovery for multiple lanes per optic

* Update formatting

* Update AUTHORS.md
This commit is contained in:
remydb
2017-04-13 11:56:16 +02:00
committed by Neil Lathwood
parent e005f78211
commit 3884a3c2f7
3 changed files with 31 additions and 0 deletions

View File

@@ -197,6 +197,7 @@ LibreNMS contributors:
- Jari Schäfer <jari.schaefer@gmail.com> (jarischaefer)
- Jan-Philipp Litza <janphilipp@litza.de> (jplitza)
- Chris Putnam <chrisputnam@gmail.com> (putnam)
- Remy de Boer <remy@slowpoke.nl> (remydb)
- Ben Klang <ben@alkaloid.net> (bklang)
Observium was written by:

View File

@@ -40,4 +40,33 @@ foreach ($pre_cache['junos_oids'] as $index => $entry) {
$entPhysicalIndex_measured = 'ports';
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'tx-'.$index, 'junos', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
}
if (is_numeric($entry['jnxDomCurrentModuleLaneCount'])) {
for ($x=0; $x<$entry['jnxDomCurrentModuleLaneCount']; $x++) {
$lane = $pre_cache['junos_multilane_oids'][$index.'.'.$x];
if (is_numeric($lane['jnxDomCurrentLaneRxLaserPower']) && $lane['jnxDomCurrentLaneRxLaserPower'] != 0 && $lane['jnxDomCurrentLaneTxLaserOutputPower'] != 0) {
$oid = '.1.3.6.1.4.1.2636.3.60.1.2.1.1.6.'.$index.'.'.$x;
$descr = dbFetchCell('SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ?', array($index, $device['device_id'])) . ' lane ' . $x . ' Rx Power';
$limit_low = $entry['jnxDomCurrentRxLaserPowerLowAlarmThreshold']/$divisor;
$warn_limit_low = $entry['jnxDomCurrentRxLaserPowerLowWarningThreshold']/$divisor;
$limit = $entry['jnxDomCurrentRxLaserPowerHighAlarmThreshold']/$divisor;
$warn_limit = $entry['jnxDomCurrentRxLaserPowerHighWarningThreshold']/$divisor;
$current = $lane['jnxDomCurrentLaneRxLaserPower']/$divisor;
$entPhysicalIndex = $index;
$entPhysicalIndex_measured = 'ports';
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'rx-'.$index.'.'.$x, 'junos', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
}
if (is_numeric($lane['jnxDomCurrentLaneTxLaserOutputPower']) && $lane['jnxDomCurrentLaneTxLaserOutputPower'] && $lane['jnxDomCurrentLaneRxLaserPower']) {
$oid = '.1.3.6.1.4.1.2636.3.60.1.2.1.1.8.'.$index.'.'.$x;
$descr = dbFetchCell('SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ?', array($index, $device['device_id'])) . ' lane ' . $x . ' Tx Power';
$limit_low = $entry['jnxDomCurrentTxLaserOutputPowerLowAlarmThreshold']/$divisor;
$warn_limit_low = $entry['jnxDomCurrentTxLaserOutputPowerLowWarningThreshold']/$divisor;
$limit = $entry['jnxDomCurrentModuleTemperatureHighAlarmThreshold']/$divisor;
$warn_limit = $entry['jnxDomCurrentModuleTemperatureHighWarningThreshold']/$divisor;
$current = $lane['jnxDomCurrentLaneTxLaserOutputPower']/$divisor;
$entPhysicalIndex = $index;
$entPhysicalIndex_measured = 'ports';
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'tx-'.$index.'.'.$x, 'junos', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
}
}
}
}

View File

@@ -12,5 +12,6 @@
if ($device['os'] === 'junos') {
$pre_cache['junos_oids'] = snmpwalk_cache_multi_oid($device, 'JnxDomCurrentEntry', array(), 'JUNIPER-DOM-MIB', 'junos');
$pre_cache['junos_multilane_oids'] = snmpwalk_cache_multi_oid($device, 'JnxDomCurrentLaneEntry', array(), 'JUNIPER-DOM-MIB', 'junos');
d_echo($pre_cache);
}