Commit version 24.12.13800

This commit is contained in:
2025-01-06 17:35:06 -05:00
parent b7f6a79c2c
commit 55d9218816
6133 changed files with 4239740 additions and 1374287 deletions

View File

@ -5,9 +5,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -18,12 +18,11 @@ cyanXcvrTxPwrLoAlrmThres.1.1.1 = -3000
cyanXcvrTxPwrLoWarnThres.1.1.1 = -2000
*/
$oids = array ('cyanXcvrTxPwrHiAlrmThres', 'cyanXcvrTxPwrHiWarnThres', 'cyanXcvrTxPwrLoAlrmThres', 'cyanXcvrTxPwrLoWarnThres');
$oids = ['cyanXcvrTxPwrHiAlrmThres', 'cyanXcvrTxPwrHiWarnThres', 'cyanXcvrTxPwrLoAlrmThres', 'cyanXcvrTxPwrLoWarnThres'];
$thresholds = array();
foreach ($oids as $oid)
{
$thresholds = snmpwalk_cache_oid($device, $oid, $thresholds, 'CYAN-XCVR-MIB:CYAN-GEPORT-MIB:CYAN-TENGPORT-MIB');
$thresholds = [];
foreach ($oids as $oid) {
$thresholds = snmpwalk_cache_oid($device, $oid, $thresholds, 'CYAN-XCVR-MIB:CYAN-GEPORT-MIB:CYAN-TENGPORT-MIB');
}
/*
@ -44,54 +43,56 @@ cyanTENGPortTxPwr.1.1.1.1 = 0
cyanTENGPortTxStatus.1.1.1.1 = on
*/
$data = array();
$oids = array('cyanTENGPortRxPwr', 'cyanTENGPortTxPwr');
foreach ($oids as $oid)
{
$data = snmpwalk_cache_oid($device, $oid, $data, 'CYAN-TENGPORT-MIB');
$data = [];
$oids = ['cyanTENGPortRxPwr', 'cyanTENGPortTxPwr'];
foreach ($oids as $oid) {
$data = snmpwalk_cache_oid($device, $oid, $data, 'CYAN-TENGPORT-MIB');
}
// Try to identify which IF-MIB port is being referred to, and populate the 'measured_entity' if we can.
$ifNames = snmpwalk_cache_oid($device, 'ifName', array(), 'IF-MIB');
foreach ($ifNames as $ifIndex => $entry)
{
$ifNames = snmpwalk_cache_oid($device, 'ifName', [], 'IF-MIB');
foreach ($ifNames as $ifIndex => $entry) {
list(, $cyan_index) = explode("-", $entry['ifName'], 2);
[, $cyan_index] = explode("-", $entry['ifName'], 2);
if ($port = get_port_by_ifIndex($device['device_id'], $ifIndex))
{
$port_translates[$cyan_index]['measured_entity'] = $port['port_id'];
}
if ($port = get_port_by_ifIndex($device['device_id'], $ifIndex)) {
$port_translates[$cyan_index]['measured_entity'] = $port['port_id'];
}
}
foreach ($data as $index => $entry)
{
foreach ($data as $index => $entry) {
list($shelf_id, $mod_id, $xcvr_id, $port_id) = explode(".", $index);
[$shelf_id, $mod_id, $xcvr_id, $port_id] = explode(".", $index);
$descr = "Transceiver ".$shelf_id."-".$mod_id."-".$xcvr_id." (".$port_id.")";
$xcvr_string = $shelf_id."-".$mod_id."-".$xcvr_id;
$descr = "Transceiver " . $shelf_id . "-" . $mod_id . "-" . $xcvr_id . " (" . $port_id . ")";
$xcvr_string = $shelf_id . "-" . $mod_id . "-" . $xcvr_id;
$options = array();
if (isset($port_translates[$xcvr_string]['measured_entity'])) { $options['measured_entity'] = $port_translates[$xcvr_string]['measured_entity']; $options['measured_class'] = 'port'; }
$options = [];
if (isset($port_translates[$xcvr_string]['measured_entity'])) {
$options['measured_entity'] = $port_translates[$xcvr_string]['measured_entity'];
$options['measured_class'] = 'port';
}
// $options['limit_high'] = $entry['cyanXcvrTxBiasHiAlrmThres'] * 0.001;
// $options['limit_low'] = $entry['cyanXcvrTxBiasLoAlrmThres'] * 0.001;
// $options['warn_high'] = $entry['cyanXcvrTxBiasHiWarnThres'] * 0.001;
// $options['warn_low'] = $entry['cyanXcvrTxBiasHiWarnThres'] * 0.001;
discover_sensor('dbm', $device, ".1.3.6.1.4.1.28533.5.30.150.1.1.1.18." . $index, $index, 'cyanTENGPortTxPwr', $descr. " TX Power", 0.001, $entry['cyanTENGPortTxPwr'], $options);
discover_sensor('dbm', $device, ".1.3.6.1.4.1.28533.5.30.150.1.1.1.18." . $index, $index, 'cyanTENGPortTxPwr', $descr . " TX Power", 0.001, $entry['cyanTENGPortTxPwr'], $options);
$options = array();
if (isset($port_translates[$xcvr_string]['measured_entity'])) { $options['measured_entity'] = $port_translates[$xcvr_string]['measured_entity']; $options['measured_class'] = 'port'; }
$options = [];
if (isset($port_translates[$xcvr_string]['measured_entity'])) {
$options['measured_entity'] = $port_translates[$xcvr_string]['measured_entity'];
$options['measured_class'] = 'port';
}
// $options['limit_high'] = $entry['cyanXcvrVccVoltHiAlrmThres'] * 0.001;
// $options['limit_low'] = $entry['cyanXcvrVccVoltLoAlrmThres'] * 0.001;
// $options['warn_high'] = $entry['cyanXcvrVccVoltHiWarnThres'] * 0.001;
// $options['warn_low'] = $entry['cyanXcvrVccVoltHiWarnThres'] * 0.001;
discover_sensor('dbm', $device, ".1.3.6.1.4.1.28533.5.30.150.1.1.1.14." . $index, $index, 'cyanTENGPortRxPwr', $descr . " RX Power", 0.001, $entry['cyanTENGPortRxPwr'], $options);
discover_sensor('dbm', $device, ".1.3.6.1.4.1.28533.5.30.150.1.1.1.14." . $index, $index, 'cyanTENGPortRxPwr', $descr . " RX Power", 0.001, $entry['cyanTENGPortRxPwr'], $options);
}