mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Inital support for Eltex-MES switches (#13036)
* Inital support for Eltex-MES switches * Eltex-MES code cleanup & added mib files * Eltex-MES mib files renamed * Eltex-MES mib files renamed(v2) * Eltex-MES added json test data * Eltex-MES added bad_iftype in YAML * Eltex-MES test data after adding bad_iftype in YAML * Eltex-MES fixed YAML & new test data * Undo module disabling Co-authored-by: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com>
This commit is contained in:
48
includes/discovery/sensors/charge/eltex-mes.inc.php
Normal file
48
includes/discovery/sensors/charge/eltex-mes.inc.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS discovery module for Eltex-MES Battery charge
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* @author Peca Nesovanovic <peca.nesovanovic@sattrakt.com>
|
||||
*/
|
||||
|
||||
$oids = snmp_walk($device, '1.3.6.1.4.1.35265.1.23.11.1.1.3', '-Osqn', '');
|
||||
$oids = trim($oids);
|
||||
|
||||
if ($oids) {
|
||||
echo "Eltex-MES charge:\n";
|
||||
|
||||
foreach (explode("\n", $oids) as $data) {
|
||||
if ($data) {
|
||||
print_r($data);
|
||||
echo "\n";
|
||||
$oid = trim(explode(' ', $data)[0]);
|
||||
$value = trim(explode(' ', $data)[1]);
|
||||
$index = trim(explode('.', $oid)[14]);
|
||||
|
||||
$type = 'eltex-mes';
|
||||
$limit = 101;
|
||||
$limitwarn = 100;
|
||||
$lowlimit = 0;
|
||||
$lowwarnlimit = 10;
|
||||
$descr = 'Battery Charge';
|
||||
|
||||
discover_sensor($valid['sensor'], 'charge', $device, $oid, $index, $type, $descr, 1, 1, $lowlimit, $lowwarnlimit, $limitwarn, $limit, $value);
|
||||
}
|
||||
}
|
||||
}
|
52
includes/discovery/sensors/current/eltex-mes.inc.php
Normal file
52
includes/discovery/sensors/current/eltex-mes.inc.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS discovery module for Eltex-MES SFP current
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* @author Peca Nesovanovic <peca.nesovanovic@sattrakt.com>
|
||||
*/
|
||||
|
||||
$low_limit = $low_warn_limit = 15;
|
||||
$high_warn_limit = $high_limit = 0;
|
||||
$divisor = 1000000;
|
||||
|
||||
$oids = snmp_walk($device, '1.3.6.1.4.1.89.90.1.2.1.3', '-Osqn', '');
|
||||
$oids = trim($oids);
|
||||
|
||||
if ($oids) {
|
||||
echo "Eltex-MES SFP TX Current:\n";
|
||||
|
||||
foreach (explode("\n", $oids) as $data) {
|
||||
if ($data) {
|
||||
print_r($data);
|
||||
echo "\n";
|
||||
$split = trim(explode(' ', $data)[0]);
|
||||
$value = trim(explode(' ', $data)[1]);
|
||||
$ifIndex = explode('.', $split)[13];
|
||||
$type = explode('.', $split)[14];
|
||||
|
||||
//type 7 = bias
|
||||
if ($type == 7) {
|
||||
$descr_oid = '1.0.8802.1.1.2.1.3.7.1.3.' . $ifIndex;
|
||||
$descr = trim(snmp_get($device, $descr_oid, '-Oqv', ''), '"');
|
||||
$value = $value / $divisor;
|
||||
discover_sensor($valid['sensor'], 'current', $device, $split, 'txbias' . $ifIndex, 'eltex-mes', 'SfpTxBias-' . $descr, $divisor, '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
60
includes/discovery/sensors/dbm/eltex-mes.inc.php
Normal file
60
includes/discovery/sensors/dbm/eltex-mes.inc.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS discovery module for Eltex-MES SFP Dbm
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* @author Peca Nesovanovic <peca.nesovanovic@sattrakt.com>
|
||||
*/
|
||||
|
||||
$low_limit = $low_warn_limit = -15;
|
||||
$high_warn_limit = $high_limit = 0;
|
||||
$divisor = 1000;
|
||||
|
||||
$oids = snmp_walk($device, '1.3.6.1.4.1.89.90.1.2.1.3', '-Osqn', '');
|
||||
$oids = trim($oids);
|
||||
|
||||
if ($oids) {
|
||||
echo "Eltex-MES dBm:\n";
|
||||
|
||||
foreach (explode("\n", $oids) as $data) {
|
||||
if ($data) {
|
||||
print_r($data);
|
||||
echo "\n";
|
||||
$split = trim(explode(' ', $data)[0]);
|
||||
$value = trim(explode(' ', $data)[1]);
|
||||
$ifIndex = explode('.', $split)[13];
|
||||
$type = explode('.', $split)[14];
|
||||
|
||||
//type8 = tx dBm
|
||||
if ($type == 8) {
|
||||
$descr_oid = '1.0.8802.1.1.2.1.3.7.1.3.' . $ifIndex;
|
||||
$descr = trim(snmp_get($device, $descr_oid, '-Oqv', ''), '"');
|
||||
$value = $value / $divisor;
|
||||
discover_sensor($valid['sensor'], 'dbm', $device, $split, 'txdbm' . $ifIndex, 'eltex-mes', 'SfpdBmTx-' . $descr, $divisor, '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $value);
|
||||
}
|
||||
|
||||
//type9 = rx dBm
|
||||
if ($type == 9) {
|
||||
$descr_oid = '1.0.8802.1.1.2.1.3.7.1.3.' . $ifIndex;
|
||||
$descr = trim(snmp_get($device, $descr_oid, '-Oqv', ''), '"');
|
||||
$value = $value / $divisor;
|
||||
discover_sensor($valid['sensor'], 'dbm', $device, $split, 'rxdbm' . $ifIndex, 'eltex-mes', 'SfpdBmRx-' . $descr, $divisor, '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
52
includes/discovery/sensors/temperature/eltex-mes.inc.php
Normal file
52
includes/discovery/sensors/temperature/eltex-mes.inc.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS discovery module for Eltex-MES SFP Temperature
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* @author Peca Nesovanovic <peca.nesovanovic@sattrakt.com>
|
||||
*/
|
||||
|
||||
$low_limit = $low_warn_limit = 5;
|
||||
$high_warn_limit = $high_limit = 70;
|
||||
$divisor = 1;
|
||||
|
||||
$oids = snmp_walk($device, '1.3.6.1.4.1.89.90.1.2.1.3', '-Osqn', '');
|
||||
$oids = trim($oids);
|
||||
|
||||
if ($oids) {
|
||||
echo "Eltex-MES SFP Temperature:\n";
|
||||
|
||||
foreach (explode("\n", $oids) as $data) {
|
||||
if ($data) {
|
||||
print_r($data);
|
||||
echo "\n";
|
||||
$split = trim(explode(' ', $data)[0]);
|
||||
$value = trim(explode(' ', $data)[1]);
|
||||
$ifIndex = explode('.', $split)[13];
|
||||
$type = explode('.', $split)[14];
|
||||
|
||||
//type5 = temperature
|
||||
if ($type == 5) {
|
||||
$descr_oid = '1.0.8802.1.1.2.1.3.7.1.3.' . $ifIndex;
|
||||
$descr = trim(snmp_get($device, $descr_oid, '-Oqv', ''), '"');
|
||||
$value = $value / $divisor;
|
||||
discover_sensor($valid['sensor'], 'temperature', $device, $split, 'SfpTemp' . $ifIndex, 'eltex-mes', 'SfpTemp-' . $descr, $divisor, '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
52
includes/discovery/sensors/voltage/eltex-mes.inc.php
Normal file
52
includes/discovery/sensors/voltage/eltex-mes.inc.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS discovery module for Eltex-MES SFP Voltage
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* @author Peca Nesovanovic <peca.nesovanovic@sattrakt.com>
|
||||
*/
|
||||
|
||||
$low_limit = $low_warn_limit = 3;
|
||||
$high_warn_limit = $high_limit = 4;
|
||||
$divisor = 1000000;
|
||||
|
||||
$oids = snmp_walk($device, '1.3.6.1.4.1.89.90.1.2.1.3', '-Osqn', '');
|
||||
$oids = trim($oids);
|
||||
|
||||
if ($oids) {
|
||||
echo "Eltex-MES Voltage:\n";
|
||||
|
||||
foreach (explode("\n", $oids) as $data) {
|
||||
if ($data) {
|
||||
print_r($data);
|
||||
echo "\n";
|
||||
$split = trim(explode(' ', $data)[0]);
|
||||
$value = trim(explode(' ', $data)[1]);
|
||||
$ifIndex = explode('.', $split)[13];
|
||||
$type = explode('.', $split)[14];
|
||||
|
||||
// type6 = voltage
|
||||
if ($type == 6) {
|
||||
$descr_oid = '1.0.8802.1.1.2.1.3.7.1.3.' . $ifIndex;
|
||||
$descr = trim(snmp_get($device, $descr_oid, '-Oqv', ''), '"');
|
||||
$value = $value / $divisor;
|
||||
discover_sensor($valid['sensor'], 'voltage', $device, $split, 'SfpVolt' . $ifIndex, 'eltex-mes', 'SfpVolt-' . $descr, $divisor, '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
37
includes/discovery/storage/eltex-mes.inc.php
Normal file
37
includes/discovery/storage/eltex-mes.inc.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/*
|
||||
*
|
||||
* LibreNMS storage discovery module for Eltex-MES.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* @author Peca Nesovanovic <peca.nesovanovic@sattrakt.com>
|
||||
*/
|
||||
|
||||
if ($device['os'] == 'eltex-mes') {
|
||||
$fstype = 'Flash';
|
||||
$descr = 'Internal Flash';
|
||||
$units = 1024;
|
||||
$index = 0;
|
||||
$free = snmp_get($device, 'rlFileFreeSizeOfFlash.0', '-Oqv', 'RADLAN-File');
|
||||
$total = snmp_get($device, 'rlFileTotalSizeOfFlash.0', '-Oqv', 'RADLAN-File');
|
||||
$used = $total - $free;
|
||||
|
||||
if (is_numeric($free) && is_numeric($total)) {
|
||||
discover_storage($valid_storage, $device, $index, $fstype, 'eltex-mes', $descr, $total, $units, $used);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user