mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
[junos] dropped dbfetch from discovery/sensors (#13784)
* [junos] dropped dbfetch from discovery/sensors * ci
This commit is contained in:
@@ -8,8 +8,9 @@
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*tis*/
|
||||
|
||||
*
|
||||
* @author Peca Nesovanovic <peca.nesovanovic@sattrakt.com>
|
||||
*/
|
||||
echo 'JunOS ';
|
||||
|
||||
$multiplier = 1;
|
||||
@@ -18,7 +19,7 @@ foreach ($pre_cache['junos_ifotn_oids'] as $index => $entry) {
|
||||
if (is_numeric($entry['jnxoptIfOTNPMCurrentFECBERMantissa'])) {
|
||||
$index = substr_replace($index, '', -2);
|
||||
$oid = '.1.3.6.1.4.1.2636.3.73.1.3.3.8.1.5.' . $index . '.1';
|
||||
$interface = dbFetchCell('SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ?', [$index, $device['device_id']]);
|
||||
$interface = get_port_by_index_cache($device['device_id'], $index)['ifDescr'];
|
||||
$descr = $interface . ' preFEC BER';
|
||||
|
||||
$limit_low = null;
|
||||
|
@@ -8,7 +8,9 @@
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
*
|
||||
* @author Peca Nesovanovic <peca.nesovanovic@sattrakt.com>
|
||||
*/
|
||||
|
||||
echo 'JunOS ';
|
||||
|
||||
@@ -17,7 +19,8 @@ $divisor = 1000000;
|
||||
foreach ($pre_cache['junos_oids'] as $index => $entry) {
|
||||
if (is_numeric($entry['jnxDomCurrentTxLaserBiasCurrent']) && $entry['jnxDomCurrentTxLaserBiasCurrent'] != 0 && $entry['jnxDomCurrentTxLaserBiasCurrentLowAlarmThreshold'] != 0) {
|
||||
$oid = '.1.3.6.1.4.1.2636.3.60.1.1.1.1.6.' . $index;
|
||||
$descr = dbFetchCell('SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ?', [$index, $device['device_id']]) . ' Tx Current';
|
||||
$interface = get_port_by_index_cache($device['device_id'], $index)['ifDescr'];
|
||||
$descr = $interface . ' Tx Current';
|
||||
$limit_low = $entry['jnxDomCurrentTxLaserBiasCurrentLowAlarmThreshold'] / $divisor;
|
||||
$warn_limit_low = $entry['jnxDomCurrentTxLaserBiasCurrentLowWarningThreshold'] / $divisor;
|
||||
$limit = $entry['jnxDomCurrentTxLaserBiasCurrentHighAlarmThreshold'] / $divisor;
|
||||
|
@@ -8,8 +8,9 @@
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
*
|
||||
* @author Peca Nesovanovic <peca.nesovanovic@sattrakt.com>
|
||||
*/
|
||||
echo 'JunOS ';
|
||||
|
||||
$multiplier = 1;
|
||||
@@ -17,7 +18,8 @@ $divisor = 100;
|
||||
foreach ($pre_cache['junos_oids'] as $index => $entry) {
|
||||
if (is_numeric($entry['jnxDomCurrentRxLaserPower']) && $entry['jnxDomCurrentRxLaserPower'] != 0 && $entry['jnxDomCurrentTxLaserOutputPower'] != 0) {
|
||||
$oid = '.1.3.6.1.4.1.2636.3.60.1.1.1.1.5.' . $index;
|
||||
$descr = dbFetchCell('SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ?', [$index, $device['device_id']]) . ' Rx Power';
|
||||
$interface = get_port_by_index_cache($device['device_id'], $index)['ifDescr'];
|
||||
$descr = $interface . ' Rx Power';
|
||||
$limit_low = $entry['jnxDomCurrentRxLaserPowerLowAlarmThreshold'] / $divisor;
|
||||
$warn_limit_low = $entry['jnxDomCurrentRxLaserPowerLowWarningThreshold'] / $divisor;
|
||||
$limit = $entry['jnxDomCurrentRxLaserPowerHighAlarmThreshold'] / $divisor;
|
||||
@@ -30,7 +32,8 @@ foreach ($pre_cache['junos_oids'] as $index => $entry) {
|
||||
|
||||
if (is_numeric($entry['jnxDomCurrentTxLaserOutputPower']) && $entry['jnxDomCurrentTxLaserOutputPower'] && $entry['jnxDomCurrentRxLaserPower']) {
|
||||
$oid = '.1.3.6.1.4.1.2636.3.60.1.1.1.1.7.' . $index;
|
||||
$descr = dbFetchCell('SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ?', [$index, $device['device_id']]) . ' Tx Power';
|
||||
$interface = get_port_by_index_cache($device['device_id'], $index)['ifDescr'];
|
||||
$descr = $interface . ' Tx Power';
|
||||
$limit_low = $entry['jnxDomCurrentTxLaserOutputPowerLowAlarmThreshold'] / $divisor;
|
||||
$warn_limit_low = $entry['jnxDomCurrentTxLaserOutputPowerLowWarningThreshold'] / $divisor;
|
||||
$limit = $entry['jnxDomCurrentTxLaserOutputPowerHighAlarmThreshold'] / $divisor;
|
||||
@@ -45,7 +48,8 @@ foreach ($pre_cache['junos_oids'] as $index => $entry) {
|
||||
$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` = ?', [$index, $device['device_id']]) . ' lane ' . $x . ' Rx Power';
|
||||
$interface = get_port_by_index_cache($device['device_id'], $index)['ifDescr'];
|
||||
$descr = $interface . ' lane ' . $x . ' Rx Power';
|
||||
$limit_low = $entry['jnxDomCurrentRxLaserPowerLowAlarmThreshold'] / $divisor;
|
||||
$warn_limit_low = $entry['jnxDomCurrentRxLaserPowerLowWarningThreshold'] / $divisor;
|
||||
$limit = $entry['jnxDomCurrentRxLaserPowerHighAlarmThreshold'] / $divisor;
|
||||
@@ -57,7 +61,8 @@ foreach ($pre_cache['junos_oids'] as $index => $entry) {
|
||||
}
|
||||
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` = ?', [$index, $device['device_id']]) . ' lane ' . $x . ' Tx Power';
|
||||
$interface = get_port_by_index_cache($device['device_id'], $index)['ifDescr'];
|
||||
$descr = $interface . ' lane ' . $x . ' Tx Power';
|
||||
$limit_low = $entry['jnxDomCurrentTxLaserOutputPowerLowAlarmThreshold'] / $divisor;
|
||||
$warn_limit_low = $entry['jnxDomCurrentTxLaserOutputPowerLowWarningThreshold'] / $divisor;
|
||||
$limit = $entry['jnxDomCurrentTxLaserOutputPowerHighAlarmThreshold'] / $divisor;
|
||||
|
@@ -1,5 +1,25 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* LibreNMS discovery module for junos Temperature
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link https://www.librenms.org
|
||||
*
|
||||
* @author Peca Nesovanovic <peca.nesovanovic@sattrakt.com>
|
||||
*/
|
||||
echo 'JunOS ';
|
||||
$oids = snmp_walk($device, '.1.3.6.1.4.1.2636.3.1.13.1.7', '-Osqn', 'JUNIPER-MIB', 'junos');
|
||||
$oids = trim($oids);
|
||||
@@ -29,7 +49,8 @@ $divisor = 1;
|
||||
foreach ($pre_cache['junos_oids'] as $index => $entry) {
|
||||
if (is_numeric($entry['jnxDomCurrentModuleTemperature']) && $entry['jnxDomCurrentModuleTemperature'] != 0 && $entry['jnxDomCurrentModuleTemperatureLowAlarmThreshold']) {
|
||||
$oid = '.1.3.6.1.4.1.2636.3.60.1.1.1.1.8.' . $index;
|
||||
$descr = dbFetchCell('SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ?', [$index, $device['device_id']]) . ' Temperature';
|
||||
$interface = get_port_by_index_cache($device['device_id'], $index)['ifDescr'];
|
||||
$descr = $interface . ' Temperature';
|
||||
$limit_low = $entry['jnxDomCurrentModuleTemperatureLowAlarmThreshold'] / $divisor;
|
||||
$warn_limit_low = $entry['jnxDomCurrentModuleTemperatureLowWarningThreshold'] / $divisor;
|
||||
$limit = $entry['jnxDomCurrentModuleTemperatureHighAlarmThreshold'] / $divisor;
|
||||
|
Reference in New Issue
Block a user