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-2021 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
@ -17,57 +17,53 @@
|
||||
|
||||
echo(" F10-S-SERIES-CHASSIS-MIB ");
|
||||
|
||||
$units = array();
|
||||
$units = [];
|
||||
|
||||
$oids = snmpwalk_cache_oid($device, "chStackUnitStatus", $oids, "F10-S-SERIES-CHASSIS-MIB");
|
||||
$oids = snmpwalk_cache_oid($device, "chStackUnitStatus", $oids, "F10-S-SERIES-CHASSIS-MIB");
|
||||
//$oids = snmpwalk_cache_oid($device, "chStackUnitRowStatus", $oids, "F10-S-SERIES-CHASSIS-MIB"); // Ignore this Row, in some cases it return incorrect data
|
||||
|
||||
foreach ($oids as $index => $entry)
|
||||
{
|
||||
if (strlen($entry['chStackUnitRowStatus']) && $entry['chStackUnitRowStatus'] != 'active')
|
||||
{
|
||||
// Skip inactive Units
|
||||
continue;
|
||||
}
|
||||
foreach ($oids as $index => $entry) {
|
||||
if (strlen($entry['chStackUnitRowStatus']) && $entry['chStackUnitRowStatus'] != 'active') {
|
||||
// Skip inactive Units
|
||||
continue;
|
||||
}
|
||||
|
||||
$descr = "Unit " . strval($index - 1);
|
||||
$units[$index] = $descr; // Store Unit name for other sensors
|
||||
$descr = "Unit " . strval($index - 1);
|
||||
$units[$index] = $descr; // Store Unit name for other sensors
|
||||
|
||||
$oid_name = 'chStackUnitStatus';
|
||||
$oid_num = '.1.3.6.1.4.1.6027.3.10.1.2.2.1.8.'.$index;
|
||||
$type = 'chStackUnitStatus';
|
||||
$value = $entry[$oid_name];
|
||||
$oid_name = 'chStackUnitStatus';
|
||||
$oid_num = '.1.3.6.1.4.1.6027.3.10.1.2.2.1.8.' . $index;
|
||||
$type = 'chStackUnitStatus';
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr . ' Status', $value, array('entPhysicalClass' => 'device'));
|
||||
discover_status($device, $oid_num, $oid_name . '.' . $index, $type, $descr . ' Status', $value, ['entPhysicalClass' => 'device']);
|
||||
}
|
||||
|
||||
$oids = snmpwalk_cache_oid($device, "chSysFanTrayOperStatus", array(), "F10-S-SERIES-CHASSIS-MIB");
|
||||
$oids = snmpwalk_cache_oid($device, "chSysFanTrayOperStatus", [], "F10-S-SERIES-CHASSIS-MIB");
|
||||
$oids = snmpwalk_cache_oid($device, "chSysPowerSupplyOperStatus", $oids, "F10-S-SERIES-CHASSIS-MIB");
|
||||
|
||||
foreach ($oids as $index => $entry)
|
||||
{
|
||||
list($unit, $tray) = explode('.', $index);
|
||||
if (!isset($units[$unit]))
|
||||
{
|
||||
// Skip inactive Units
|
||||
continue;
|
||||
}
|
||||
foreach ($oids as $index => $entry) {
|
||||
[$unit, $tray] = explode('.', $index);
|
||||
if (!isset($units[$unit])) {
|
||||
// Skip inactive Units
|
||||
continue;
|
||||
}
|
||||
|
||||
$descr = $units[$unit];
|
||||
$descr = $units[$unit];
|
||||
|
||||
$oid_name = 'chSysFanTrayOperStatus';
|
||||
$oid_num = '.1.3.6.1.4.1.6027.3.10.1.2.4.1.2.'.$index;
|
||||
$type = 'chSysOperStatus';
|
||||
$value = $entry[$oid_name];
|
||||
$oid_name = 'chSysFanTrayOperStatus';
|
||||
$oid_num = '.1.3.6.1.4.1.6027.3.10.1.2.4.1.2.' . $index;
|
||||
$type = 'chSysOperStatus';
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr . ' Fan '. $tray, $value, array('entPhysicalClass' => 'fan'));
|
||||
discover_status($device, $oid_num, $oid_name . '.' . $index, $type, $descr . ' Fan ' . $tray, $value, ['entPhysicalClass' => 'fan']);
|
||||
|
||||
$oid_name = 'chSysPowerSupplyOperStatus';
|
||||
$oid_num = '.1.3.6.1.4.1.6027.3.10.1.2.3.1.2.'.$index;
|
||||
$type = 'chSysOperStatus';
|
||||
$value = $entry[$oid_name];
|
||||
$oid_name = 'chSysPowerSupplyOperStatus';
|
||||
$oid_num = '.1.3.6.1.4.1.6027.3.10.1.2.3.1.2.' . $index;
|
||||
$type = 'chSysOperStatus';
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr . ' PowerSupply '. $tray, $value, array('entPhysicalClass' => 'powersupply'));
|
||||
discover_status($device, $oid_num, $oid_name . '.' . $index, $type, $descr . ' PowerSupply ' . $tray, $value, ['entPhysicalClass' => 'powersupply']);
|
||||
}
|
||||
|
||||
// DOM sensors
|
||||
@ -89,56 +85,53 @@ foreach ($oids as $index => $entry)
|
||||
//F10-S-SERIES-CHASSIS-MIB::chSysPortXfpTxPower.1.2 = INTEGER: -5.36 dB
|
||||
//F10-S-SERIES-CHASSIS-MIB::chSysPortXfpTxPower.13.1 = INTEGER: .00 dB
|
||||
|
||||
$oids = snmpwalk_cache_oid($device, "chSysPortIfIndex", array(), "F10-S-SERIES-CHASSIS-MIB");
|
||||
if (safe_count($oids))
|
||||
{
|
||||
$oids = snmpwalk_cache_oid($device, "chSysPortXfpRecvPower", $oids, "F10-S-SERIES-CHASSIS-MIB");
|
||||
$oids = snmpwalk_cache_oid($device, "chSysPortXfpTxPower", $oids, "F10-S-SERIES-CHASSIS-MIB");
|
||||
$oids = snmpwalk_cache_oid($device, "chSysPortXfpRecvTemp", $oids, "F10-S-SERIES-CHASSIS-MIB");
|
||||
if (OBS_DEBUG > 1) { print_vars($oids); }
|
||||
|
||||
foreach ($oids as $index => $entry)
|
||||
{
|
||||
if (($entry['chSysPortXfpRecvPower'] === '655.35' && $entry['chSysPortXfpTxPower'] === '655.35' && $entry['chSysPortXfpRecvTemp'] === '65535') ||
|
||||
($entry['chSysPortXfpRecvPower'] === '.00' && $entry['chSysPortXfpTxPower'] === '.00' && $entry['chSysPortXfpRecvTemp'] === '0') ||
|
||||
($entry['chSysPortXfpRecvPower'] === '.00' && !is_numeric($entry['chSysPortXfpTxPower']) && !is_numeric($entry['chSysPortXfpRecvTemp']))) // Fix for old S25/S50 series
|
||||
{
|
||||
continue;
|
||||
}
|
||||
list(, $entPhysicalIndex) = explode('.', $index);
|
||||
|
||||
$port = get_port_by_index_cache($device['device_id'], $entry['chSysPortIfIndex']);
|
||||
$options = array('entPhysicalIndex' => $entPhysicalIndex,
|
||||
'measured_class' => 'port',
|
||||
'measured_entity' => $port['port_id']);
|
||||
|
||||
if (is_numeric($entry['chSysPortXfpRecvPower']))
|
||||
{
|
||||
$oid = ".1.3.6.1.4.1.6027.3.10.1.2.5.1.6.".$index;
|
||||
$descr = $port['ifDescr'] . " RX Power";
|
||||
$value = $entry['chSysPortXfpRecvPower'] * 100;
|
||||
|
||||
discover_sensor('dbm', $device, $oid, $index, 'f10-s-series-dom-rx', $descr, 0.01, $value, $options);
|
||||
$oids = snmpwalk_cache_oid($device, "chSysPortIfIndex", [], "F10-S-SERIES-CHASSIS-MIB");
|
||||
if (safe_count($oids)) {
|
||||
$oids = snmpwalk_cache_oid($device, "chSysPortXfpRecvPower", $oids, "F10-S-SERIES-CHASSIS-MIB");
|
||||
$oids = snmpwalk_cache_oid($device, "chSysPortXfpTxPower", $oids, "F10-S-SERIES-CHASSIS-MIB");
|
||||
$oids = snmpwalk_cache_oid($device, "chSysPortXfpRecvTemp", $oids, "F10-S-SERIES-CHASSIS-MIB");
|
||||
if (OBS_DEBUG > 1) {
|
||||
print_vars($oids);
|
||||
}
|
||||
|
||||
if (is_numeric($entry['chSysPortXfpTxPower']))
|
||||
{
|
||||
$oid = ".1.3.6.1.4.1.6027.3.10.1.2.5.1.8.".$index;
|
||||
$descr = $port['ifDescr'] . " TX Power";
|
||||
$value = $entry['chSysPortXfpTxPower'] * 100;
|
||||
foreach ($oids as $index => $entry) {
|
||||
if (($entry['chSysPortXfpRecvPower'] === '655.35' && $entry['chSysPortXfpTxPower'] === '655.35' && $entry['chSysPortXfpRecvTemp'] === '65535') ||
|
||||
($entry['chSysPortXfpRecvPower'] === '.00' && $entry['chSysPortXfpTxPower'] === '.00' && $entry['chSysPortXfpRecvTemp'] === '0') ||
|
||||
($entry['chSysPortXfpRecvPower'] === '.00' && !is_numeric($entry['chSysPortXfpTxPower']) && !is_numeric($entry['chSysPortXfpRecvTemp']))) // Fix for old S25/S50 series
|
||||
{
|
||||
continue;
|
||||
}
|
||||
[, $entPhysicalIndex] = explode('.', $index);
|
||||
|
||||
discover_sensor('dbm', $device, $oid, $index, 'f10-s-series-dom-tx', $descr, 0.01, $value, $options);
|
||||
$port = get_port_by_index_cache($device['device_id'], $entry['chSysPortIfIndex']);
|
||||
$options = ['entPhysicalIndex' => $entPhysicalIndex,
|
||||
'measured_class' => 'port',
|
||||
'measured_entity' => $port['port_id']];
|
||||
|
||||
if (is_numeric($entry['chSysPortXfpRecvPower'])) {
|
||||
$oid = ".1.3.6.1.4.1.6027.3.10.1.2.5.1.6." . $index;
|
||||
$descr = $port['ifDescr'] . " RX Power";
|
||||
$value = $entry['chSysPortXfpRecvPower'] * 100;
|
||||
|
||||
discover_sensor('dbm', $device, $oid, $index, 'f10-s-series-dom-rx', $descr, 0.01, $value, $options);
|
||||
}
|
||||
|
||||
if (is_numeric($entry['chSysPortXfpTxPower'])) {
|
||||
$oid = ".1.3.6.1.4.1.6027.3.10.1.2.5.1.8." . $index;
|
||||
$descr = $port['ifDescr'] . " TX Power";
|
||||
$value = $entry['chSysPortXfpTxPower'] * 100;
|
||||
|
||||
discover_sensor('dbm', $device, $oid, $index, 'f10-s-series-dom-tx', $descr, 0.01, $value, $options);
|
||||
}
|
||||
|
||||
if (is_numeric($entry['chSysPortXfpRecvTemp'])) {
|
||||
$oid = ".1.3.6.1.4.1.6027.3.10.1.2.5.1.7." . $index;
|
||||
$descr = $port['ifDescr'] . " DOM";
|
||||
$value = $entry['chSysPortXfpRecvTemp'];
|
||||
|
||||
discover_sensor('temperature', $device, $oid, $index, 'f10-s-series-dom', $descr, 1, $value, $options);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_numeric($entry['chSysPortXfpRecvTemp']))
|
||||
{
|
||||
$oid = ".1.3.6.1.4.1.6027.3.10.1.2.5.1.7.".$index;
|
||||
$descr = $port['ifDescr'] . " DOM";
|
||||
$value = $entry['chSysPortXfpRecvTemp'];
|
||||
|
||||
discover_sensor('temperature', $device, $oid, $index, 'f10-s-series-dom', $descr, 1, $value, $options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
Reference in New Issue
Block a user