Convert opengear to YAML-based discovery, add some new sensors, add test data (#10553)

* Update opengear MIBs to latest version.

* Replace PHP signal discovery with YAML.

* Update Opengear YAML with new sensors.

* Add test data for Opengear.

* Add the test data json for Opengear.

* Named to numbered index to avoid data loss.
This commit is contained in:
Martijn Schmidt
2019-08-27 23:54:08 +02:00
committed by Tony Murray
parent 852647198b
commit 3a891ba727
9 changed files with 2829 additions and 66 deletions

View File

@@ -0,0 +1,65 @@
mib: OG-STATUSv2-MIB
modules:
sensors:
pre-cache:
data:
- oid:
- ogCellModemTable
- ogEmdTemperatureTable
temperature:
data:
-
oid: ogEmdTemperatureTable
value: ogEmdTemperatureValue
num_oid: '.1.3.6.1.4.1.25049.17.9.1.5.{{ $index }}'
descr: ogEmdTemperatureName
index: 'ogEmdTemperatureValue.{{ $index }}'
signal:
data:
-
oid: ogCellModemTable
value: ogCellModem3gRssi
num_oid: '.1.3.6.1.4.1.25049.17.17.1.11.{{ $index }}'
descr: 'Cellular 3G Modem RSSI'
index: '11.{{ $index }}'
-
oid: ogCellModemTable
value: ogCellModem4gRssi
num_oid: '.1.3.6.1.4.1.25049.17.17.1.12.{{ $index }}'
descr: 'Cellular 4G Modem RSSI'
index: '12.{{ $index }}'
count:
data:
-
oid: ogCellModemTable
value: ogCellModemSelectedSimCard
num_oid: '.1.3.6.1.4.1.25049.17.17.1.14.{{ $index }}'
descr: 'Selected Active SIM Card'
index: 'ogCellModemSelectedSimCard.{{ $index }}'
state:
data:
-
oid: ogCellModemTable
value: ogCellModemConnected
num_oid: '.1.3.6.1.4.1.25049.17.17.1.5.{{ $index }}'
descr: 'Modem Connection State'
index: 'ogCellModemConnected.{{ $index }}'
state_name: ogCellModemConnected
states:
- { value: 1, descr: Connected, graph: 1, generic: 0 }
- { value: 2, descr: Disconnected, graph: 2, generic: 2 }
-
oid: ogCellModemTable
value: ogCellModemRadioTechnology
num_oid: '.1.3.6.1.4.1.25049.17.17.1.9.{{ $index }}'
descr: 'Radio Access Technology'
index: 'ogCellModemRadioTechnology.{{ $index }}'
skip_values: 1
state_name: ogCellModemRadioTechnology
states:
- { value: 1, descr: Unavailable, graph: 1, generic: 3 }
- { value: 2, descr: CDMA, graph: 2, generic: 0 }
- { value: 3, descr: EVDO, graph: 3, generic: 0 }
- { value: 4, descr: GSM, graph: 4, generic: 0 }
- { value: 5, descr: UMTS, graph: 5, generic: 0 }
- { value: 6, descr: LTE, graph: 6, generic: 0 }

View File

@@ -2,6 +2,8 @@ os: opengear
text: Opengear
type: 'OOB Management'
icon: opengear
over:
- { graph: device_signal, text: 'Signal' }
mib_dir:
- opengear
discovery:

View File

@@ -1,50 +0,0 @@
<?php
/**
* opengear.inc.php
*
* LibreNMS signal sensor discovery module for Opengear Devices
*
* 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 2017 Lorenzo Zafra
* @author Lorenzo Zafra<zafra@ualberta.ca>
*/
// 3G Signal
$threeG_signal = trim(snmp_get($device, 'ogCellModem3gRssi.1', '-Oqv', 'OG-STATUSv2-MIB'), '" ');
if (!empty($threeG_signal)) {
$divisor = 1;
$index = '11.1';
$descr = 'Cellular 3G RSSI';
$type = 'opengear';
$oid = '.1.3.6.1.4.1.25049.17.17.1.11.1';
$current_value = $threeG_signal / $divisor;
discover_sensor($valid['sensor'], 'signal', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current_value);
}
// 4G Signal
$fourG_signal = trim(snmp_get($device, 'ogCellModem4gRssi.1', '-Oqv', 'OG-STATUSv2-MIB'), '" ');
if (!empty($fourG_signal)) {
$divisor = 1;
$index = '12.1';
$descr = 'Cellular 4G RSSI';
$type = 'opengear';
$oid = '.1.3.6.1.4.1.25049.17.17.1.12.1';
$current_value = $fourG_signal / $divisor;
discover_sensor($valid['sensor'], 'signal', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current_value);
}