AirFiber additional modulation rates, fix gpsSync (#9563)

* Add QAM1024 modulation for AirFiber
Move sensors to yaml

* Fix 0 index

* add additional data
make compatible with old sensors

* Fix whitespace
This commit is contained in:
Tony Murray
2018-12-28 20:11:24 -06:00
committed by GitHub
parent fd573bc879
commit 3dce7aa90c
6 changed files with 1963 additions and 227 deletions

View File

@@ -1039,7 +1039,7 @@ function discovery_process(&$valid, $device, $sensor_type, $pre_cache)
$value = ($value / $divisor) * $multiplier;
}
$uindex = str_replace('{{ $index }}', $index, $data['index'] ?: $index);
$uindex = str_replace('{{ $index }}', $index, isset($data['index']) ? $data['index'] : $index);
discover_sensor($valid['sensor'], $sensor_type, $device, $oid, $uindex, $sensor_name, $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $warn_limit, $high_limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured, $user_function);
if ($sensor_type === 'state') {

View File

@@ -1,118 +0,0 @@
<?php
/**
* airos-af.inc.php
*
* Ubiquiti AirFiber States
*
* 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 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
$mod = snmp_get($device, 'curTXModRate.1', "-Ovqe", "UBNT-AirFIBER-MIB");
if (is_numeric($mod)) {
$state_name = 'curTXModRate';
$index = $state_name;
$state_index_id = create_state_index($state_name);
if ($state_index_id !== null) {
$states = array(
array($state_index_id, 'qPSK-SISO-1-4x', 1, 0, 1),
array($state_index_id, 'qPSK-SISO-1x', 1, 1, 1),
array($state_index_id, 'qPSK-MIMO-2x', 1, 2, 0),
array($state_index_id, 'qAM16-MIMO-4x', 1, 4, 0),
array($state_index_id, 'qAM64-MIMO-6x', 1, 6, 0),
array($state_index_id, 'qAM256-MIMO-8x', 1, 8, 0),
);
foreach ($states as $value) {
$insert = array(
'state_index_id' => $value[0],
'state_descr' => $value[1],
'state_draw_graph' => $value[2],
'state_value' => $value[3],
'state_generic_value' => $value[4]
);
dbInsert($insert, 'state_translations');
}
}
discover_sensor(
$valid['sensor'],
'state',
$device,
'.1.3.6.1.4.1.41112.1.3.2.1.2.1',
$index,
$state_name,
'Tx Modulation Rate',
1,
1,
null,
null,
null,
null,
$mod
);
create_sensor_to_state_index($device, $state_name, $index);
}
$gps = snmp_get($device, 'gpsSync.1', "-Ovqe", "UBNT-AirFIBER-MIB");
if (is_numeric($gps)) {
$state_name = 'gpsSync';
$index = $state_name;
$state_index_id = create_state_index($state_name);
if ($state_index_id !== null) {
$states = array(
array($state_index_id, 'off', 1, 1, 1),
array($state_index_id, 'on', 1, 4, 0),
);
foreach ($states as $value) {
$insert = array(
'state_index_id' => $value[0],
'state_descr' => $value[1],
'state_draw_graph' => $value[2],
'state_value' => $value[3],
'state_generic_value' => $value[4]
);
dbInsert($insert, 'state_translations');
}
}
discover_sensor(
$valid['sensor'],
'state',
$device,
'.1.3.6.1.4.1.41112.1.3.1.1.8.1',
$index,
$state_name,
'GPS Sync',
1,
1,
null,
null,
null,
null,
$mod
);
create_sensor_to_state_index($device, $state_name, $index);
}
unset($mod, $gps, $state_name, $index, $state_index_id, $states, $descr);

View File

@@ -1,66 +0,0 @@
<?php
/**
* airos-af.inc.php
*
* Ubiquiti AirFiber Temperatures
*
* 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 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
$temps = snmp_get_multi($device, 'radio0TempC.1 radio1TempC.1', '-OQUs', 'UBNT-AirFIBER-MIB');
if (isset($temps[1]['radio0TempC'])) {
discover_sensor(
$valid['sensor'],
'temperature',
$device,
'.1.3.6.1.4.1.41112.1.3.2.1.8.1',
0,
'airos-af',
'Radio 0 Temp',
1,
1,
null,
null,
null,
null,
$temps[1]['radio0TempC']
);
}
if (isset($temps[1]['radio1TempC'])) {
discover_sensor(
$valid['sensor'],
'temperature',
$device,
'.1.3.6.1.4.1.41112.1.3.2.1.10.1',
1,
'airos-af',
'Radio 1 Temp',
1,
1,
null,
null,
null,
null,
$temps[1]['radio1TempC']
);
}
unset($temps);