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:
53
includes/definitions/discovery/eltex-mes.yaml
Normal file
53
includes/definitions/discovery/eltex-mes.yaml
Normal file
@@ -0,0 +1,53 @@
|
||||
mib: RADLAN-rndMng:RADLAN-HWENVIROMENT:ELTEX-MES-HWENVIROMENT-MIB:RADLAN-Physicaldescription-MIB
|
||||
modules:
|
||||
os:
|
||||
version: .1.3.6.1.2.1.47.1.1.1.1.10.67108992
|
||||
hardware: .1.3.6.1.2.1.47.1.1.1.1.13.67108992
|
||||
serial: .1.3.6.1.2.1.47.1.1.1.1.11.67108992
|
||||
|
||||
processors:
|
||||
data:
|
||||
-
|
||||
oid: rlCpuUtilDuringLast5Minutes
|
||||
num_oid: '.1.3.6.1.4.1.89.1.9.{{ $index }}'
|
||||
|
||||
mempools:
|
||||
data:
|
||||
-
|
||||
total: .1.3.6.1.4.1.35265.41.1.2.1.1.3.0
|
||||
free: .1.3.6.1.4.1.35265.41.1.2.1.1.7.0
|
||||
|
||||
sensors:
|
||||
state:
|
||||
data:
|
||||
-
|
||||
oid: rlEnvMonFanStatusTable
|
||||
value: rlEnvMonFanState
|
||||
num_oid: '.1.3.6.1.4.1.89.83.1.1.1.3.{{ $index }}'
|
||||
descr: '{{ rlEnvMonFanStatusDescr }} status'
|
||||
index: 'mesFanStatus.{{ $index }}'
|
||||
states:
|
||||
- { value: 1, descr: OK, graph: 1, generic: 0 }
|
||||
- { value: 5, descr: Missing, graph: 1, generic: 3 }
|
||||
-
|
||||
oid: eltEnvMonBatteryStatusEntry
|
||||
value: eltEnvMonBatteryState
|
||||
num_oid: '.1.3.6.1.4.1.35265.1.23.11.1.1.2.{{ $index }}'
|
||||
descr: 'Backup battery status'
|
||||
index: 'mesBattStatus.{{ $index }}'
|
||||
states:
|
||||
- { value: 1, descr: Charged, graph: 1, generic: 0 }
|
||||
- { value: 2, descr: Discharged, graph: 1, generic: 2 }
|
||||
- { value: 3, descr: Low, graph: 1, generic: 1 }
|
||||
- { value: 5, descr: Missing, graph: 1, generic: 3 }
|
||||
- { value: 6, descr: BattFuseError, graph: 1, generic: 2 }
|
||||
- { value: 7, descr: Charging, graph: 1, generic: 1 }
|
||||
|
||||
temperature:
|
||||
data:
|
||||
-
|
||||
oid: rlPhdUnitEnvParamEntry
|
||||
value: rlPhdUnitEnvParamTempSensorValue
|
||||
num_oid: '.1.3.6.1.4.1.89.53.15.1.10.{{ $index }}'
|
||||
descr: 'Chassis #{{ $index }} Temp'
|
||||
index: 'mesChassisTemp.{{ $index }}'
|
||||
23
includes/definitions/eltex-mes.yaml
Normal file
23
includes/definitions/eltex-mes.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
os: eltex-mes
|
||||
text: Eltex-mes
|
||||
ifname: true
|
||||
type: network
|
||||
icon: eltex
|
||||
over:
|
||||
- { graph: device_bits, text: 'Device Traffic' }
|
||||
- { graph: device_processor, text: 'CPU Usage' }
|
||||
- { graph: device_mempool, text: 'Memory Usage' }
|
||||
|
||||
discovery:
|
||||
-
|
||||
sysObjectID:
|
||||
- .1.3.6.1.4.1.35265.1.112
|
||||
- .1.3.6.1.4.1.35265.1.83
|
||||
|
||||
mib_dir: eltex
|
||||
|
||||
bad_iftype:
|
||||
- tunnel
|
||||
- softwareLoopback
|
||||
- propVirtual
|
||||
- propPointToPointSerial
|
||||
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);
|
||||
}
|
||||
}
|
||||
30
includes/polling/storage/eltex-mes.inc.php
Normal file
30
includes/polling/storage/eltex-mes.inc.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/*
|
||||
*
|
||||
* LibreNMS storage poller 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') {
|
||||
$storage['units'] = 1024;
|
||||
$storage['free'] = snmp_get($device, 'rlFileFreeSizeOfFlash.0', '-Oqv', 'RADLAN-File');
|
||||
$storage['size'] = snmp_get($device, 'rlFileTotalSizeOfFlash.0', '-Oqv', 'RADLAN-File');
|
||||
$storage['used'] = $storage['size'] - $storage['free'];
|
||||
}
|
||||
Reference in New Issue
Block a user