mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Add Huawei VRP sensors to yaml and fix bug in functions.inc.php (#7918)
* Add Huawei sensors to yaml and fix bug in functions.inc.php * Add Huawei sensors to yaml and fix bug in functions.inc.php
This commit is contained in:
committed by
Neil Lathwood
parent
c30a5e8977
commit
e473b03697
62
includes/definitions/discovery/vrp.yaml
Normal file
62
includes/definitions/discovery/vrp.yaml
Normal file
@@ -0,0 +1,62 @@
|
||||
mib: HUAWEI-ENTITY-EXTENT-MIB
|
||||
modules:
|
||||
sensors:
|
||||
pre-cache:
|
||||
data:
|
||||
- oid:
|
||||
- entPhysicalName
|
||||
temperature:
|
||||
data:
|
||||
-
|
||||
oid: hwOpticalModuleInfoTable
|
||||
value: hwEntityOpticalTemperature
|
||||
num_oid: .1.3.6.1.4.1.2011.5.25.31.1.1.3.1.5.
|
||||
descr: '{{ $entPhysicalName }}'
|
||||
index: '{{ $index }}'
|
||||
skip_value_lt: -50
|
||||
-
|
||||
oid: hwEntityStateTable
|
||||
value: hwEntityTemperature
|
||||
num_oid: .1.3.6.1.4.1.2011.5.25.31.1.1.1.1.11.
|
||||
descr: '{{ $entPhysicalName }}'
|
||||
index: '{{ $index }}'
|
||||
skip_values: 0
|
||||
dbm:
|
||||
data:
|
||||
-
|
||||
oid: hwOpticalModuleInfoTable
|
||||
value: hwEntityOpticalRxPower
|
||||
num_oid: .1.3.6.1.4.1.2011.5.25.31.1.1.3.1.8.
|
||||
descr: '{{ $entPhysicalName }} Rx'
|
||||
index: 'rx-{{ $index }}'
|
||||
skip_values: -1
|
||||
user_func: 'uw_to_dbm'
|
||||
-
|
||||
oid: hwOpticalModuleInfoTable
|
||||
value: hwEntityOpticalTxPower
|
||||
num_oid: .1.3.6.1.4.1.2011.5.25.31.1.1.3.1.9.
|
||||
descr: '{{ $entPhysicalName }} Tx'
|
||||
index: 'tx-{{ $index }}'
|
||||
skip_values: -1
|
||||
user_func: 'uw_to_dbm'
|
||||
voltage:
|
||||
data:
|
||||
-
|
||||
oid: hwOpticalModuleInfoTable
|
||||
value: hwEntityOpticalVoltage
|
||||
num_oid: .1.3.6.1.4.1.2011.5.25.31.1.1.3.1.6.
|
||||
descr: '{{ $entPhysicalName }}'
|
||||
index: '{{ $index }}'
|
||||
skip_values: -1
|
||||
divisor: 1000
|
||||
current:
|
||||
data:
|
||||
-
|
||||
oid: hwOpticalModuleInfoTable
|
||||
value: hwEntityOpticalBiasCurrent
|
||||
num_oid: .1.3.6.1.4.1.2011.5.25.31.1.1.3.1.7.
|
||||
descr: '{{ $entPhysicalName }}'
|
||||
index: '{{ $index }}'
|
||||
skip_values: -1
|
||||
divisor: 1000000
|
||||
|
@@ -986,8 +986,8 @@ function discovery_process(&$valid, $device, $sensor_type, $pre_cache)
|
||||
|
||||
foreach ($raw_data as $index => $snmp_data) {
|
||||
$user_function = null;
|
||||
if (isset($data['user_function'])) {
|
||||
$user_function = $data['user_function'];
|
||||
if (isset($data['user_func'])) {
|
||||
$user_function = $data['user_func'];
|
||||
}
|
||||
// get the value for this sensor, check 'value' and 'oid', if state string, translate to a number
|
||||
$data_name = isset($data['value']) ? $data['value'] : $data['oid']; // fallback to oid if value is not set
|
||||
|
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* vrp.inc.php
|
||||
*
|
||||
* LibreNMS current sensor discovery module for VRP
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2016 Neil Lathwood
|
||||
* @author Neil Lathwood <neil@lathwood.co.uk>
|
||||
*/
|
||||
|
||||
echo 'Huawei VRP ';
|
||||
$data = $pre_cache['vrp_oids']['hwEntityOpticalBiasCurrent'];
|
||||
|
||||
foreach ($data as $index => $value) {
|
||||
if (is_numeric($value) && $value >= 0) {
|
||||
$oid = '.1.3.6.1.4.1.2011.5.25.31.1.1.3.1.7.' . $index;
|
||||
$descr = $pre_cache['vrp_oids']['entPhysicalName'][$index];
|
||||
discover_sensor(
|
||||
$valid['sensor'],
|
||||
'current',
|
||||
$device,
|
||||
$oid,
|
||||
$index,
|
||||
'vrp',
|
||||
$descr,
|
||||
1000,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
70,
|
||||
75,
|
||||
$value
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,77 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* vrp.inc.php
|
||||
*
|
||||
* LibreNMS dbm sensor discovery module for VRP
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2016 Neil Lathwood
|
||||
* @author Neil Lathwood <neil@lathwood.co.uk>
|
||||
*/
|
||||
|
||||
echo 'Huawei VRP ';
|
||||
$data = $pre_cache['vrp_oids']['hwEntityOpticalRxPower'];
|
||||
|
||||
foreach ($data as $index => $value) {
|
||||
if (is_numeric($value) && $value >= 0) {
|
||||
$value = uw_to_dbm($value);
|
||||
$oid = '.1.3.6.1.4.1.2011.5.25.31.1.1.3.1.8.' . $index;
|
||||
$descr = $pre_cache['vrp_oids']['entPhysicalName'][$index] . ' Rx';
|
||||
discover_sensor(
|
||||
$valid['sensor'],
|
||||
'dbm',
|
||||
$device,
|
||||
$oid,
|
||||
'rx-' . $index,
|
||||
'vrp',
|
||||
$descr,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
70,
|
||||
75,
|
||||
$value
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$data = $pre_cache['vrp_oids']['hwEntityOpticalTxPower'];
|
||||
|
||||
foreach ($data as $index => $value) {
|
||||
if (is_numeric($value) && $value >= 0) {
|
||||
$value = uw_to_dbm($value);
|
||||
$oid = '.1.3.6.1.4.1.2011.5.25.31.1.1.3.1.9.' . $index;
|
||||
$descr = $pre_cache['vrp_oids']['entPhysicalName'][$index] . ' Tx';
|
||||
discover_sensor(
|
||||
$valid['sensor'],
|
||||
'dbm',
|
||||
$device,
|
||||
$oid,
|
||||
'tx-' . $index,
|
||||
'vrp',
|
||||
$descr,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
70,
|
||||
75,
|
||||
$value
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* vrp.inc.php
|
||||
*
|
||||
* LibreNMS sensor pre-cache discovery module for VRP
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2016 Neil Lathwood
|
||||
* @author Neil Lathwood <neil@lathwood.co.uk>
|
||||
*/
|
||||
|
||||
echo 'hwEntityStateEntry ';
|
||||
$pre_cache['vrp_oids'] = snmpwalk_cache_index($device, '.1.3.6.1.4.1.2011.5.25.31.1.1.1.1', array(), 'HUAWEI-ENTITY-EXTENT-MIB');
|
||||
|
||||
echo 'hwOpticalModuleInfoEntry ';
|
||||
$pre_cache['vrp_oids'] = snmpwalk_cache_index($device, '.1.3.6.1.4.1.2011.5.25.31.1.1.3.1', $pre_cache['vrp_oids'], 'HUAWEI-ENTITY-EXTENT-MIB');
|
||||
|
||||
echo 'entPhysicalName ';
|
||||
$pre_cache['vrp_oids'] = snmpwalk_cache_index($device, '.1.3.6.1.2.1.47.1.1.1.1.7', $pre_cache['vrp_oids'], 'HUAWEI-ENTITY-EXTENT-MIB');
|
@@ -1,78 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* vrp.inc.php
|
||||
*
|
||||
* LibreNMS temperature sensor discovery module for VRP
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2016 Neil Lathwood
|
||||
* @author Neil Lathwood <neil@lathwood.co.uk>
|
||||
*/
|
||||
|
||||
echo 'Huawei VRP ';
|
||||
|
||||
$data = $pre_cache['vrp_oids']['hwEntityTemperature'];
|
||||
|
||||
foreach ($data as $index => $value) {
|
||||
if (is_numeric($value) && $value > 0) {
|
||||
$oid = '.1.3.6.1.4.1.2011.5.25.31.1.1.1.1.11.' . $index;
|
||||
$descr = $pre_cache['vrp_oids']['entPhysicalName'][$index];
|
||||
$high_temp_thresh = $pre_cache['vrp_oids']['hwEntityTemperatureThreshold'][$index];
|
||||
$low_temp_thresh = $pre_cache['vrp_oids']['hwEntityTemperatureLowThreshold'][$index];
|
||||
discover_sensor(
|
||||
$valid['sensor'],
|
||||
'temperature',
|
||||
$device,
|
||||
$oid,
|
||||
$index,
|
||||
'vrp',
|
||||
$descr,
|
||||
1,
|
||||
1,
|
||||
$low_temp_thresh,
|
||||
$low_temp_thresh,
|
||||
$high_temp_thresh,
|
||||
$high_temp_thresh,
|
||||
$value
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$data = $pre_cache['vrp_oids']['hwEntityOpticalTemperature'];
|
||||
|
||||
foreach ($data as $index => $value) {
|
||||
if (is_numeric($value) && $value >= 0) {
|
||||
$oid = '.1.3.6.1.4.1.2011.5.25.31.1.1.3.1.5.' . $index;
|
||||
$descr = $pre_cache['vrp_oids']['entPhysicalName'][$index];
|
||||
discover_sensor(
|
||||
$valid['sensor'],
|
||||
'temperature',
|
||||
$device,
|
||||
$oid,
|
||||
$index,
|
||||
'vrp',
|
||||
$descr,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
70,
|
||||
75,
|
||||
$value
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* vrp.inc.php
|
||||
*
|
||||
* LibreNMS voltage sensor discovery module for VRP
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2016 Neil Lathwood
|
||||
* @author Neil Lathwood <neil@lathwood.co.uk>
|
||||
*/
|
||||
|
||||
echo 'Huawei VRP ';
|
||||
$data = $pre_cache['vrp_oids']['hwEntityOpticalVoltage'];
|
||||
|
||||
foreach ($data as $index => $value) {
|
||||
if (is_numeric($value) && $value >= 0) {
|
||||
$oid = '.1.3.6.1.4.1.2011.5.25.31.1.1.3.1.6.' . $index;
|
||||
$descr = $pre_cache['vrp_oids']['entPhysicalName'][$index];
|
||||
discover_sensor(
|
||||
$valid['sensor'],
|
||||
'voltage',
|
||||
$device,
|
||||
$oid,
|
||||
$index,
|
||||
'vrp',
|
||||
$descr,
|
||||
1000,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
70,
|
||||
75,
|
||||
$value
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* vrp.inc.php
|
||||
*
|
||||
* LibreNMS dbm sensor poller module for VRP
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2016 Neil Lathwood
|
||||
* @author Neil Lathwood <neil@lathwood.co.uk>
|
||||
*/
|
||||
|
||||
$sensor_value = uw_to_dbm($sensor_value);
|
Reference in New Issue
Block a user