mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Merge pull request #3741 from laf/junos-optics
This commit is contained in:
@ -892,14 +892,6 @@ function generate_ap_url($ap, $vars=array()) {
|
||||
|
||||
}//end generate_ap_url()
|
||||
|
||||
|
||||
function report_this($message) {
|
||||
global $config;
|
||||
return '<h2>'.$message.' Please <a href="'.$config['project_issues'].'">report this</a> to the '.$config['project_name'].' developers.</h2>';
|
||||
|
||||
}//end report_this()
|
||||
|
||||
|
||||
function report_this_text($message) {
|
||||
global $config;
|
||||
return $message.'\nPlease report this to the '.$config['project_name'].' developers at '.$config['project_issues'].'\n';
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
$valid['sensor'] = array();
|
||||
|
||||
// Pre-cache data for later use
|
||||
require 'includes/discovery/sensors/pre-cache.inc.php';
|
||||
|
||||
require 'includes/discovery/sensors/cisco-entity-sensor.inc.php';
|
||||
require 'includes/discovery/sensors/entity-sensor.inc.php';
|
||||
require 'includes/discovery/sensors/ipmi.inc.php';
|
||||
|
34
includes/discovery/sensors/current/junos.inc.php
Normal file
34
includes/discovery/sensors/current/junos.inc.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2016 Neil Lathwood <neil@lathwood.co.uk>
|
||||
* 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. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if ($device['os'] == 'junos' || $device['os_group'] == 'junos') {
|
||||
echo 'JunOS ';
|
||||
|
||||
$multiplier = 1;
|
||||
$divisor = 1000000;
|
||||
foreach ($junos_oids as $index => $entry) {
|
||||
if (is_numeric($entry['jnxDomCurrentTxLaserBiasCurrent'])) {
|
||||
$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` = ?', array($index, $device['device_id'])) . ' Rx Current';
|
||||
$limit_low = $entry['jnxDomCurrentTxLaserBiasCurrentLowAlarmThreshold']/$divisor;
|
||||
$warn_limit_low = $entry['jnxDomCurrentTxLaserBiasCurrentLowWarningThreshold']/$divisor;
|
||||
$limit = $entry['jnxDomCurrentTxLaserBiasCurrentHighAlarmThreshold']/$divisor;
|
||||
$warn_limit = $entry['jnxDomCurrentTxLaserBiasCurrentHighWarningThreshold']/$divisor;
|
||||
$current = $entry['jnxDomCurrentTxLaserBiasCurrent'];
|
||||
$entPhysicalIndex = $index;
|
||||
$entPhysicalIndex_measured = 'ports';
|
||||
discover_sensor($valid['sensor'], 'current', $device, $oid, 'rx-'.$index, 'junos', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
47
includes/discovery/sensors/dbm/junos.inc.php
Normal file
47
includes/discovery/sensors/dbm/junos.inc.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2016 Neil Lathwood <neil@lathwood.co.uk>
|
||||
* 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. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if ($device['os'] == 'junos' || $device['os_group'] == 'junos') {
|
||||
echo 'JunOS ';
|
||||
|
||||
$multiplier = 1;
|
||||
$divisor = 100;
|
||||
foreach ($junos_oids as $index => $entry) {
|
||||
if (is_numeric($entry['jnxDomCurrentRxLaserPower'])) {
|
||||
$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` = ?', array($index, $device['device_id'])) . ' Rx Power';
|
||||
$limit_low = $entry['jnxDomCurrentRxLaserPowerLowAlarmThreshold']/$divisor;
|
||||
$warn_limit_low = $entry['jnxDomCurrentRxLaserPowerLowWarningThreshold']/$divisor;
|
||||
$limit = $entry['jnxDomCurrentRxLaserPowerHighAlarmThreshold']/$divisor;
|
||||
$warn_limit = $entry['jnxDomCurrentRxLaserPowerHighWarningThreshold']/$divisor;
|
||||
$current = $entry['jnxDomCurrentRxLaserPower'];
|
||||
$entPhysicalIndex = $index;
|
||||
$entPhysicalIndex_measured = 'ports';
|
||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'rx-'.$index, 'junos', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||
}
|
||||
|
||||
if (is_numeric($entry['jnxDomCurrentTxLaserOutputPower'])) {
|
||||
$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` = ?', array($index, $device['device_id'])) . ' Tx Power';
|
||||
$limit_low = $entry['jnxDomCurrentTxLaserOutputPowerLowAlarmThreshold']/$divisor;
|
||||
$warn_limit_low = $entry['jnxDomCurrentTxLaserOutputPowerLowWarningThreshold']/$divisor;
|
||||
$limit = $entry['jnxDomCurrentModuleTemperatureHighAlarmThreshold']/$divisor;
|
||||
$warn_limit = $entry['jnxDomCurrentModuleTemperatureHighWarningThreshold']/$divisor;
|
||||
$current = $entry['jnxDomCurrentTxLaserOutputPower'];
|
||||
$entPhysicalIndex = $index;
|
||||
$entPhysicalIndex_measured = 'ports';
|
||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'tx-'.$index, 'junos', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
19
includes/discovery/sensors/pre-cache.inc.php
Normal file
19
includes/discovery/sensors/pre-cache.inc.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2016 Neil Lathwood <neil@lathwood.co.uk>
|
||||
* 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. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
echo 'Pre-cache: ';
|
||||
|
||||
// Include all discovery modules
|
||||
$include_dir = 'includes/discovery/sensors/pre-cache';
|
||||
require 'includes/include-dir.inc.php';
|
||||
|
||||
echo "\n";
|
22
includes/discovery/sensors/pre-cache/junos.inc.php
Normal file
22
includes/discovery/sensors/pre-cache/junos.inc.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2016 Neil Lathwood <neil@lathwood.co.uk>
|
||||
* 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. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if ($device['os'] == 'junos') {
|
||||
|
||||
echo 'Pre-cache JunOS: ';
|
||||
|
||||
$junos_oids = array();
|
||||
echo 'Caching OIDs:';
|
||||
|
||||
$junos_oids = snmpwalk_cache_multi_oid($device, 'JnxDomCurrentEntry', $oids, 'JUNIPER-DOM-MIB', $config['mib_dir'].':'.$config['mib_dir'].'/junos');
|
||||
|
||||
}
|
@ -26,4 +26,21 @@ if ($device['os'] == 'junos' || $device['os_group'] == 'junos') {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$multiplier = 1;
|
||||
$divisor = 1;
|
||||
foreach ($junos_oids as $index => $entry) {
|
||||
if (is_numeric($entry['jnxDomCurrentModuleTemperature'])) {
|
||||
$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` = ?', array($index, $device['device_id'])) . ' Temperature';
|
||||
$limit_low = $entry['jnxDomCurrentModuleTemperatureLowAlarmThreshold']/$divisor;
|
||||
$warn_limit_low = $entry['jnxDomCurrentModuleTemperatureLowWarningThreshold']/$divisor;
|
||||
$limit = $entry['jnxDomCurrentModuleTemperatureHighAlarmThreshold']/$divisor;
|
||||
$warn_limit = $entry['jnxDomCurrentModuleTemperatureHighWarningThreshold']/$divisor;
|
||||
$current = $entry['jnxDomCurrentModuleTemperature'];
|
||||
$entPhysicalIndex = $index;
|
||||
$entPhysicalIndex_measured = 'ports';
|
||||
discover_sensor($valid['sensor'], 'temperature', $device, $oid, 'rx-'.$index, 'junos', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1535,3 +1535,9 @@ function create_sensor_to_state_index($device, $state_name, $index)
|
||||
dbInsert($insert, 'sensors_to_state_indexes');
|
||||
}
|
||||
}
|
||||
|
||||
function report_this($message) {
|
||||
global $config;
|
||||
return '<h2>'.$message.' Please <a href="'.$config['project_issues'].'">report this</a> to the '.$config['project_name'].' developers.</h2>';
|
||||
|
||||
}//end report_this()
|
||||
|
Reference in New Issue
Block a user