Teleste Luminato ports & qam/asi output sensors & yaml (#13616)

* Luminato: bitrate sensor

* bitrate sensor Eloquent

* luminato ports

* luminato ports styleci

* luminato QAM/ASI sensor

* luminato QAM/ASI sensor styleci

* YAML & test

* drop debug $ver from sensor type

* mess with Teleste ifExtPhysInterface/ifExtLogiInterface

* styleci

* test data

* mistake in port discovery

* left out Graphs->Health->Overview->Bitrate label

* fixed Bitrate graph, copy/paste errors
This commit is contained in:
Peca Nesovanovic
2022-01-08 18:17:08 +01:00
committed by GitHub
parent 4696b7fc3d
commit 2d57e49caf
20 changed files with 653 additions and 8 deletions

View File

@@ -26,6 +26,11 @@ if ($device['os'] == 'airos-af-ltu') {
require 'ports/airos-af-ltu.inc.php';
}
//Teleste Luminato ifOperStatus
if ($device['os'] == 'luminato') {
require base_path('includes/discovery/ports/luminato.inc.php');
}
// End Building SNMP Cache Array
d_echo($port_stats);

View File

@@ -0,0 +1,34 @@
<?php
/**
* luminato.inc.php
*
* LibreNMS discovery module for Teleste Luminato. Modify ifOperStatus
*
* 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/>.
*
* @link https://www.librenms.org
*
* @copyrigh 2021 Peca Nesovanovic
*
* @author Peca Nesovanovic <peca.nesovanovic@sattrakt.com>
*/
$ver = intval($device['version']);
d_echo('PORTS: Luminato v' . $ver);
if ($ver >= 20) {
$ifmib = SnmpQuery::walk('IF-MIB::ifConnectorPresent')->table(2);
foreach ($port_stats as $key => $data) {
$port_stats[$key]['ifOperStatus'] = $ifmib[$key]['IF-MIB::ifConnectorPresent'] ? 'up' : 'down';
}
}

View File

@@ -68,6 +68,7 @@ $run_sensors = [
'count',
'temperature',
'tv_signal',
'bitrate',
'voltage',
'snr',
'pressure',

View File

@@ -0,0 +1,66 @@
<?php
/*
* LibreNMS discovery module for Teleste Luminato ASI/QAM bitrate
*
* 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
*
* @copyright 2021 Peca Nesovanovic
*
* @author Peca Nesovanovic <peca.nesovanovic@sattrakt.com>
*/
$divisor = 1;
$ver = intval($device['version']);
$boid = '.1.3.6.1.4.1.3715.17.3.3.1.';
if (is_array($pre_cache['transfer'])) {
d_echo('Luminato transfer' . $ver);
foreach ($pre_cache['transfer'] as $key => $data) {
if ($data['ifExtDirection'] == 'output') {
if ($ver < 10) { //v10 and up auto reset transBitrateMax, older version could not use this sensor
$value = $data['transBitrate'] / $divisor;
$oid = $boid . '2.' . $key;
} else {
$value = $data['transBitrateMax'] / $divisor;
$oid = $boid . '4.' . $key;
}
unset($defrate);
$mnr = $pre_cache['transfer'][$key]['ifExtModule']; //module nr
$mname = $pre_cache['entPhysicalDescr'][$mnr]['entPhysicalDescr']; //module name
if ($mname == 'LQM-C' || $mname == 'LDM-C') { //QAM module
$defrate = 50; //default bitrate for QAM module
}
if ($mname == 'LAS-D') { //AsiOut module
$defrate = 60; //default bitrate for AsiOut module
}
if (isset($defrate)) {
$type = 'Transfer_' . $mname;
$defrate = $defrate * 1000 * 1000;
$descr = $mname . ' output ';
$descr .= sprintf('%02d', $pre_cache['transfer'][$key]['ifExtModule']) . '.'; //include module nr
$descr .= sprintf('%02d', $pre_cache['transfer'][$key]['ifExtPhysInterface']) . '.';
$descr .= sprintf('%02d', $pre_cache['transfer'][$key]['ifExtLogiInterface']);
$group = 'Slot ' . $mnr;
$limit = $defrate * 1; //100%
$limitwarn = $defrate * 0.8; //80%
$lowlimit = 0;
$lowwarnlimit = $defrate * 0.1; //10%
discover_sensor($valid['sensor'], 'bitrate', $device, $oid, $key, $type, $descr, $divisor, 1, $lowlimit, $lowwarnlimit, $limitwarn, $limit, $value, 'snmp', null, null, null, $group);
}
}
}
}

View File

@@ -0,0 +1,43 @@
<?php
/*
* LibreNMS pre-cache module for Teleste Luminato
*
* 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
*
* @copyright 2021 Peca Nesovanovic
*
* @author Peca Nesovanovic <peca.nesovanovic@sattrakt.com>
*/
echo 'Luminato ';
$oidt = snmp_walk($device, 'TransferEntry', '-OsQ', 'TELESTE-LUMINATO-MIB');
$oidt = trim($oidt);
$oidi = snmp_walk($device, 'IfExtEntry', '-OsQ', 'TELESTE-LUMINATO-MIB');
$oidi = trim($oidi);
$oids = $oidt . "\n" . $oidi;
if ($oids) {
foreach (explode("\n", $oids) as $data) {
if ($data) {
$split = explode('=', $data);
$value = trim($split[1]);
$index = trim(explode('.', $split[0])[1]);
$name = trim(explode('.', $split[0])[0]);
$pre_cache['transfer'][$index][$name] = $value;
}
}
}