mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Added values from SFP DDM values for awplus switches (#15522)
* Added values from SFP DDM's * Added tempreture as well * Fixed indention and generel code style * Update awplus.inc.php * Fixed coding style * More code style fixes * More style fixes * Test data * Test data that only contains/matches the sensors added.
This commit is contained in:
40
includes/discovery/sensors/current/awplus.inc.php
Normal file
40
includes/discovery/sensors/current/awplus.inc.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
$divisor = 1000000;
|
||||
|
||||
if ($pre_cache['awplus-sfpddm']) {
|
||||
foreach ($pre_cache['awplus-sfpddm'] as $index => $data) {
|
||||
if (isset($data['atPluggableDiagTxBiasStatusReading'])) {
|
||||
$ifIndex = explode('.', $index, 2)[0];
|
||||
$high_limit = isset($data['atPluggableDiagTxBiasAlarmMax']) ? ($data['atPluggableDiagTxBiasAlarmMax'] / $divisor) : null;
|
||||
$high_warn_limit = isset($data['atPluggableDiagTxBiasWarningMax']) ? ($data['atPluggableDiagTxBiasWarningMax'] / $divisor) : null;
|
||||
$low_warn_limit = isset($data['atPluggableDiagTxBiasWarningMin']) ? ($data['atPluggableDiagTxBiasWarningMin'] / $divisor) : null;
|
||||
$low_limit = isset($data['atPluggableDiagTxBiasAlarmMin']) ? ($data['atPluggableDiagTxBiasAlarmMin'] / $divisor) : null;
|
||||
|
||||
$tmp = get_port_by_index_cache($device['device_id'], $ifIndex);
|
||||
$descr = $tmp['ifName'];
|
||||
$oid = '.1.3.6.1.4.1.207.8.4.4.3.28.1.3.1.3.' . $index;
|
||||
discover_sensor(
|
||||
$valid['sensor'],
|
||||
'current',
|
||||
$device,
|
||||
$oid,
|
||||
'SFP:' . $descr,
|
||||
'atPluggableDiagTxBiasStatusReading',
|
||||
'SFP:' . $descr,
|
||||
$divisor,
|
||||
null, // $multiplier,
|
||||
$low_limit,
|
||||
$low_warn_limit,
|
||||
$high_warn_limit,
|
||||
$high_limit,
|
||||
$value,
|
||||
'snmp',
|
||||
$ifIndex,
|
||||
null,
|
||||
null,
|
||||
'SFP'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
76
includes/discovery/sensors/dbm/awplus.inc.php
Normal file
76
includes/discovery/sensors/dbm/awplus.inc.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
$divisor = 10000;
|
||||
|
||||
if ($pre_cache['awplus-sfpddm']) {
|
||||
foreach ($pre_cache['awplus-sfpddm'] as $index => $data) {
|
||||
if (isset($data['atPluggableDiagTxPowerStatusReading'])) {
|
||||
$ifIndex = explode('.', $index, 2)[0];
|
||||
$high_limit = isset($data['atPluggableDiagTxPowerAlarmMax']) ? mw_to_dbm($data['atPluggableDiagTxPowerAlarmMax'] / $divisor) : null;
|
||||
$high_warn_limit = isset($data['atPluggableDiagTxPowerWarningMax']) ? mw_to_dbm($data['atPluggableDiagTxPowerWarningMax'] / $divisor) : null;
|
||||
$low_warn_limit = isset($data['atPluggableDiagTxPowerWarningMin']) ? mw_to_dbm($data['atPluggableDiagTxPowerWarningMin'] / $divisor) : null;
|
||||
$low_limit = isset($data['atPluggableDiagTxPowerAlarmMin']) ? mw_to_dbm($data['atPluggableDiagTxPowerAlarmMin'] / $divisor) : null;
|
||||
|
||||
$tmp = get_port_by_index_cache($device['device_id'], $ifIndex);
|
||||
$descr = $tmp['ifName'];
|
||||
$oid = '.1.3.6.1.4.1.207.8.4.4.3.28.1.4.1.3.' . $index;
|
||||
discover_sensor(
|
||||
$valid['sensor'],
|
||||
'dbm',
|
||||
$device,
|
||||
$oid,
|
||||
'SFP:' . $descr,
|
||||
'atPluggableDiagTxPowerStatusReading',
|
||||
'SFP:' . $descr,
|
||||
$divisor,
|
||||
null, // $multiplier,
|
||||
$low_limit,
|
||||
$low_warn_limit,
|
||||
$high_warn_limit,
|
||||
$high_limit,
|
||||
$value,
|
||||
'snmp',
|
||||
$ifIndex,
|
||||
null,
|
||||
'mw_to_dbm',
|
||||
'TX Power'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($pre_cache['awplus-sfpddm']) {
|
||||
foreach ($pre_cache['awplus-sfpddm'] as $index => $data) {
|
||||
if (isset($data['atPluggableDiagRxPowerStatusReading'])) {
|
||||
$ifIndex = explode('.', $index, 2)[0];
|
||||
$high_limit = isset($data['atPluggableDiagRxPowerAlarmMax']) ? mw_to_dbm($data['atPluggableDiagRxPowerAlarmMax'] / $divisor) : null;
|
||||
$high_warn_limit = isset($data['atPluggableDiagRxPowerWarningMax']) ? mw_to_dbm($data['atPluggableDiagRxPowerWarningMax'] / $divisor) : null;
|
||||
$low_warn_limit = isset($data['atPluggableDiagRxPowerWarningMin']) ? mw_to_dbm($data['atPluggableDiagRxPowerWarningMin'] / $divisor) : null;
|
||||
$low_limit = isset($data['atPluggableDiagRxPowerAlarmMin']) ? mw_to_dbm($data['atPluggableDiagRxPowerAlarmMin'] / $divisor) : null;
|
||||
|
||||
$tmp = get_port_by_index_cache($device['device_id'], $ifIndex);
|
||||
$descr = $tmp['ifName'];
|
||||
$oid = '.1.3.6.1.4.1.207.8.4.4.3.28.1.5.1.3.' . $index;
|
||||
discover_sensor(
|
||||
$valid['sensor'],
|
||||
'dbm',
|
||||
$device,
|
||||
$oid,
|
||||
'SFP:' . $descr,
|
||||
'atPluggableDiagRxPowerStatusReading',
|
||||
'SFP:' . $descr,
|
||||
$divisor,
|
||||
null, // $multiplier,
|
||||
$low_limit,
|
||||
$low_warn_limit,
|
||||
$high_warn_limit,
|
||||
$high_limit,
|
||||
$value,
|
||||
'snmp',
|
||||
$ifIndex,
|
||||
null,
|
||||
'mw_to_dbm',
|
||||
'RX Power'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
19
includes/discovery/sensors/pre-cache/awplus.inc.php
Normal file
19
includes/discovery/sensors/pre-cache/awplus.inc.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
echo 'atPluggableDiagTempEntry ';
|
||||
$pre_cache['awplus-sfpddm'] = snmpwalk_cache_oid($device, 'atPluggableDiagTempEntry', [], 'AT-PLUGGABLE-DIAGNOSTICS-MIB');
|
||||
|
||||
echo 'atPluggableDiagVccEntry ';
|
||||
$pre_cache['awplus-sfpddm'] = snmpwalk_cache_oid($device, 'atPluggableDiagVccEntry', $pre_cache['awplus-sfpddm'], 'AT-PLUGGABLE-DIAGNOSTICS-MIB');
|
||||
|
||||
echo 'atPluggableDiagTxBiasEntry ';
|
||||
$pre_cache['awplus-sfpddm'] = snmpwalk_cache_oid($device, 'atPluggableDiagTxBiasEntry', $pre_cache['awplus-sfpddm'], 'AT-PLUGGABLE-DIAGNOSTICS-MIB');
|
||||
|
||||
echo 'atPluggableDiagTxPowerEntry ';
|
||||
$pre_cache['awplus-sfpddm'] = snmpwalk_cache_oid($device, 'atPluggableDiagTxPowerEntry', $pre_cache['awplus-sfpddm'], 'AT-PLUGGABLE-DIAGNOSTICS-MIB');
|
||||
|
||||
echo 'atPluggableDiagRxPowerEntry ';
|
||||
$pre_cache['awplus-sfpddm'] = snmpwalk_cache_oid($device, 'atPluggableDiagRxPowerEntry', $pre_cache['awplus-sfpddm'], 'AT-PLUGGABLE-DIAGNOSTICS-MIB');
|
||||
|
||||
echo 'atPluggableDiagRxLosTable ';
|
||||
$pre_cache['awplus-sfpddm'] = snmpwalk_cache_oid($device, 'atPluggableDiagRxLosTable', $pre_cache['awplus-sfpddm'], 'AT-PLUGGABLE-DIAGNOSTICS-MIB');
|
40
includes/discovery/sensors/temperature/awplus.inc.php
Normal file
40
includes/discovery/sensors/temperature/awplus.inc.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
$divisor = 1000;
|
||||
|
||||
if ($pre_cache['awplus-sfpddm']) {
|
||||
foreach ($pre_cache['awplus-sfpddm'] as $index => $data) {
|
||||
if (isset($data['atPluggableDiagTempStatusReading'])) {
|
||||
$ifIndex = explode('.', $index, 2)[0];
|
||||
$high_limit = isset($data['atPluggableDiagTempAlarmMax']) ? $data['atPluggableDiagTempAlarmMax'] / $divisor : null;
|
||||
$high_warn_limit = isset($data['atPluggableDiagTempWarningMax']) ? $data['atPluggableDiagTempWarningMax'] / $divisor : null;
|
||||
$low_warn_limit = isset($data['atPluggableDiagTempWarningMin']) ? $data['atPluggableDiagTempWarningMin'] / $divisor : null;
|
||||
$low_limit = isset($data['atPluggableDiagTempAlarmMin']) ? $data['atPluggableDiagTempAlarmMin'] / $divisor : null;
|
||||
|
||||
$tmp = get_port_by_index_cache($device['device_id'], $ifIndex);
|
||||
$descr = $tmp['ifName'];
|
||||
$oid = '.1.3.6.1.4.1.207.8.4.4.3.28.1.1.1.3.' . $index;
|
||||
discover_sensor(
|
||||
$valid['sensor'],
|
||||
'temperature',
|
||||
$device,
|
||||
$oid,
|
||||
'SFP:' . $descr,
|
||||
'atPluggableDiagTempStatusReading',
|
||||
'SFP:' . $descr,
|
||||
$divisor,
|
||||
null, // $multiplier,
|
||||
$low_limit,
|
||||
$low_warn_limit,
|
||||
$high_warn_limit,
|
||||
$high_limit,
|
||||
$value,
|
||||
'snmp',
|
||||
$ifIndex,
|
||||
null,
|
||||
null,
|
||||
'SFP Temperature'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
40
includes/discovery/sensors/voltage/awplus.inc.php
Normal file
40
includes/discovery/sensors/voltage/awplus.inc.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
$divisor = 10000;
|
||||
|
||||
if ($pre_cache['awplus-sfpddm']) {
|
||||
foreach ($pre_cache['awplus-sfpddm'] as $index => $data) {
|
||||
if (isset($data['atPluggableDiagVccStatusReading'])) {
|
||||
$ifIndex = explode('.', $index, 2)[0];
|
||||
$high_limit = isset($data['atPluggableDiagVccAlarmMax']) ? ($data['atPluggableDiagVccAlarmMax'] / $divisor) : null;
|
||||
$high_warn_limit = isset($data['atPluggableDiagVccWarningMax']) ? ($data['atPluggableDiagVccWarningMax'] / $divisor) : null;
|
||||
$low_warn_limit = isset($data['atPluggableDiagVccWarningMin']) ? ($data['atPluggableDiagVccWarningMin'] / $divisor) : null;
|
||||
$low_limit = isset($data['atPluggableDiagVccAlarmMin']) ? ($data['atPluggableDiagVccAlarmMin'] / $divisor) : null;
|
||||
|
||||
$tmp = get_port_by_index_cache($device['device_id'], $ifIndex);
|
||||
$descr = $tmp['ifName'];
|
||||
$oid = '.1.3.6.1.4.1.207.8.4.4.3.28.1.2.1.3.' . $index;
|
||||
discover_sensor(
|
||||
$valid['sensor'],
|
||||
'voltage',
|
||||
$device,
|
||||
$oid,
|
||||
'SFP:' . $descr,
|
||||
'atPluggableDiagVccStatusReading',
|
||||
'SFP:' . $descr,
|
||||
$divisor,
|
||||
null, // $multiplier,
|
||||
$low_limit,
|
||||
$low_warn_limit,
|
||||
$high_warn_limit,
|
||||
$high_limit,
|
||||
$value,
|
||||
'snmp',
|
||||
$ifIndex,
|
||||
null,
|
||||
null,
|
||||
'SFP'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
1192
tests/data/awplus_sfp.json
Normal file
1192
tests/data/awplus_sfp.json
Normal file
File diff suppressed because it is too large
Load Diff
71
tests/snmpsim/awplus_sfp.snmprec
Normal file
71
tests/snmpsim/awplus_sfp.snmprec
Normal file
@@ -0,0 +1,71 @@
|
||||
1.3.6.1.2.1.1.1.0|4|Allied Telesis router/switch, Software (AlliedWare Plus) Version 5.5.0-2.3
|
||||
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.207.1.4.253
|
||||
1.3.6.1.2.1.99.1.1.1.4.35|2|2194
|
||||
1.3.6.1.2.1.99.1.1.1.4.36|2|1803
|
||||
1.3.6.1.2.1.99.1.1.1.4.37|2|999
|
||||
1.3.6.1.2.1.99.1.1.1.4.38|2|3351
|
||||
1.3.6.1.2.1.99.1.1.1.4.39|2|5000
|
||||
1.3.6.1.2.1.99.1.1.1.4.40|2|1215
|
||||
1.3.6.1.2.1.99.1.1.1.4.41|2|49
|
||||
1.3.6.1.2.1.99.1.1.1.4.42|2|52
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.1.1.5.1.1.1|66|2129
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.1.1.7.1.1.1|2|2
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.1.1.1.2|66|1
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.1.1.1.3|66|1
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.1.1.1.4|66|1
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.1.1.1.5|66|1
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.1.1.1.6|66|1
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.2.1.1.2|66|1
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.2.1.1.3|66|1
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.2.1.1.4|66|1
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.2.1.1.5|66|1
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.2.1.1.6|66|1
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.3.1.1.2|66|2
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.3.1.1.3|66|3
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.3.1.1.4|66|4
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.3.1.1.5|66|5
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.3.1.1.6|66|6
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.4.1.1.2|4|Voltage: 1.8V
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.4.1.1.3|4|Voltage: 1.0V
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.4.1.1.4|4|Voltage: 3.3V
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.4.1.1.5|4|Voltage: 5.0V
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.4.1.1.6|4|Voltage: 1.2V
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.5.1.1.2|2|1803
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.5.1.1.3|2|999
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.5.1.1.4|2|3351
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.5.1.1.5|2|5000
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.5.1.1.6|2|1215
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.6.1.1.2|2|1975
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.6.1.1.3|2|1090
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.6.1.1.4|2|3562
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.6.1.1.5|2|5498
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.6.1.1.6|2|1292
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.7.1.1.2|2|1612
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.7.1.1.3|2|891
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.7.1.1.4|2|3028
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.7.1.1.5|2|4503
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.7.1.1.6|2|1046
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.8.1.1.2|2|2
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.8.1.1.3|2|2
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.8.1.1.4|2|2
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.8.1.1.5|2|2
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.2.1.8.1.1.6|2|2
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.3.1.1.1.1.7|66|1
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.3.1.1.1.1.8|66|1
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.3.1.2.1.1.7|66|1
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.3.1.2.1.1.8|66|1
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.3.1.3.1.1.7|66|7
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.3.1.3.1.1.8|66|8
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.3.1.4.1.1.7|4|Temp: CPU
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.3.1.4.1.1.8|4|Temp: System
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.3.1.5.1.1.7|2|49
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.3.1.5.1.1.8|2|52
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.3.1.6.1.1.7|2|65
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.3.1.6.1.1.8|2|65
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.3.1.7.1.1.7|2|2
|
||||
1.3.6.1.4.1.207.8.4.4.3.12.3.1.7.1.1.8|2|2
|
||||
1.3.6.1.4.1.207.8.4.4.3.28.1.1.1.3.5028.1|2|57984
|
||||
1.3.6.1.4.1.207.8.4.4.3.28.1.2.1.3.5028.1|2|33065
|
||||
1.3.6.1.4.1.207.8.4.4.3.28.1.3.1.3.5028.1|2|41124
|
||||
1.3.6.1.4.1.207.8.4.4.3.28.1.4.1.3.5028.1|2|5738
|
||||
1.3.6.1.4.1.207.8.4.4.3.28.1.5.1.3.5028.1|2|92
|
Reference in New Issue
Block a user