mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* Sensors remove reliance on global variable * Apply fixes from StyleCI * Clear the instance instead of reset. Remove $valid['sensors'] from docs --------- Co-authored-by: Tony Murray <murrant@users.noreply.github.com>
41 lines
1.6 KiB
PHP
41 lines
1.6 KiB
PHP
<?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(
|
|
null,
|
|
'current',
|
|
$device,
|
|
$oid,
|
|
'SFP:' . $descr,
|
|
'atPluggableDiagTxBiasStatusReading',
|
|
'SFP:' . $descr,
|
|
$divisor,
|
|
1,
|
|
$low_limit,
|
|
$low_warn_limit,
|
|
$high_warn_limit,
|
|
$high_limit,
|
|
$data['atPluggableDiagTxBiasStatusReading'] / $divisor,
|
|
'snmp',
|
|
$ifIndex,
|
|
null,
|
|
null,
|
|
'SFP'
|
|
);
|
|
}
|
|
}
|
|
}
|