librenms: add patch (from my upstream PR) to fix fetching RSRQ/RSSI/etc
from mikrotik devices where the LTE interface isn't on index 1.
This commit is contained in:
parent
19d40b1101
commit
eff8a3a388
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.128 2021/06/20 11:33:06 sthen Exp $
|
||||
# $OpenBSD: Makefile,v 1.129 2021/06/25 16:29:54 sthen Exp $
|
||||
|
||||
COMMENT= auto-discovering network management/monitoring system
|
||||
|
||||
@ -9,6 +9,8 @@ GH_TAGNAME= 21.6.0
|
||||
DISTFILES= librenms-${GH_TAGNAME}.tar.gz librenms-vendor-${GH_TAGNAME}.tar.xz:0
|
||||
EPOCH= 0
|
||||
|
||||
REVISION= 0
|
||||
|
||||
CATEGORIES= net www
|
||||
|
||||
HOMEPAGE= https://www.librenms.org/
|
||||
|
152
net/librenms/patches/patch-LibreNMS_OS_Routeros_php
Normal file
152
net/librenms/patches/patch-LibreNMS_OS_Routeros_php
Normal file
@ -0,0 +1,152 @@
|
||||
$OpenBSD: patch-LibreNMS_OS_Routeros_php,v 1.1 2021/06/25 16:29:54 sthen Exp $
|
||||
|
||||
From 1125750d3c7c332f2ca43f4518a4588b0c708392 Mon Sep 17 00:00:00 2001
|
||||
From: Stuart Henderson <stu@spacehopper.org>
|
||||
Date: Tue, 22 Jun 2021 17:57:51 +0100
|
||||
Subject: [PATCH 1/6] don't hardcode index for Mikrotik LTE wireless statistics
|
||||
|
||||
https://github.com/librenms/librenms/pull/12976
|
||||
|
||||
Index: LibreNMS/OS/Routeros.php
|
||||
--- LibreNMS/OS/Routeros.php.orig
|
||||
+++ LibreNMS/OS/Routeros.php
|
||||
@@ -221,8 +221,9 @@ class Routeros extends OS implements
|
||||
if (is_null($this->data)) {
|
||||
$wl60 = snmpwalk_cache_oid($this->getDeviceArray(), 'mtxrWl60GTable', [], 'MIKROTIK-MIB');
|
||||
$wlap = snmpwalk_cache_oid($this->getDeviceArray(), 'mtxrWlApTable', [], 'MIKROTIK-MIB');
|
||||
+ $wllte = snmpwalk_cache_oid($this->getDeviceArray(), 'mtxrLTEModemTable', [], 'MIKROTIK-MIB');
|
||||
$wl60sta = snmpwalk_cache_oid($this->getDeviceArray(), 'mtxrWl60GStaTable', [], 'MIKROTIK-MIB');
|
||||
- $this->data = $wl60 + $wlap;
|
||||
+ $this->data = $wl60 + $wlap + $wllte;
|
||||
$this->data = $this->data + $wl60sta;
|
||||
}
|
||||
|
||||
@@ -265,6 +266,18 @@ class Routeros extends OS implements
|
||||
'SSID: ' . $entry['mtxrWlApSsid'],
|
||||
$entry[$oid]
|
||||
);
|
||||
+ } elseif (($entry['mtxrLTEModemInterfaceIndex'] !== null)) {
|
||||
+ $intname = snmp_get($this->getDeviceArray(),
|
||||
+ 'mtxrInterfaceStatsName.' . $index, '-OQv', 'MIKROTIK-MIB');
|
||||
+ $sensors[] = new WirelessSensor(
|
||||
+ $type,
|
||||
+ $this->getDeviceId(),
|
||||
+ $num_oid_base . $index,
|
||||
+ 'mikrotik',
|
||||
+ $index,
|
||||
+ $intname,
|
||||
+ $entry[$oid]
|
||||
+ );
|
||||
} else {
|
||||
$sensors[] = new WirelessSensor(
|
||||
$type,
|
||||
@@ -281,55 +294,82 @@ class Routeros extends OS implements
|
||||
return $sensors;
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Discover LTE RSRQ. This is in Dbm. Type is Dbm.
|
||||
+ * Returns an array of LibreNMS\Device\Sensor objects that have been discovered
|
||||
+ *
|
||||
+ * @return array Sensors
|
||||
+ */
|
||||
public function discoverWirelessRsrq()
|
||||
{
|
||||
- $sinr = '.1.3.6.1.4.1.14988.1.1.16.1.1.3.1'; //MIKROTIK-MIB::mtxrLTEModemSignalRSRQ
|
||||
-
|
||||
- return [
|
||||
- new WirelessSensor(
|
||||
+ $data = $this->fetchData();
|
||||
+ $sensors = [];
|
||||
+ foreach ($data as $index => $entry) {
|
||||
+ $intname = snmp_get($this->getDeviceArray(),
|
||||
+ 'mtxrInterfaceStatsName.' . $index, '-OQv', 'MIKROTIK-MIB');
|
||||
+ $sensors[] = new WirelessSensor(
|
||||
'rsrq',
|
||||
$this->getDeviceId(),
|
||||
- $sinr,
|
||||
+ '.1.3.6.1.4.1.14988.1.1.16.1.1.3.' . $index,
|
||||
'routeros',
|
||||
- 0,
|
||||
- 'Signal RSRQ',
|
||||
+ $index,
|
||||
+ $intname . ': Signal RSRQ',
|
||||
null
|
||||
- ),
|
||||
- ];
|
||||
+ ); // mtxrLTEModemSignalRSRQ
|
||||
+ }
|
||||
+ return $sensors;
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Discover LTE RSRP. This is in Dbm. Type is Dbm.
|
||||
+ * Returns an array of LibreNMS\Device\Sensor objects that have been discovered
|
||||
+ *
|
||||
+ * @return array Sensors
|
||||
+ */
|
||||
public function discoverWirelessRsrp()
|
||||
{
|
||||
- $sinr = '.1.3.6.1.4.1.14988.1.1.16.1.1.4.1'; //MIKROTIK-MIB::mtxrLTEModemSignalRSRP
|
||||
-
|
||||
- return [
|
||||
- new WirelessSensor(
|
||||
+ $data = $this->fetchData();
|
||||
+ $sensors = [];
|
||||
+ foreach ($data as $index => $entry) {
|
||||
+ $intname = snmp_get($this->getDeviceArray(),
|
||||
+ 'mtxrInterfaceStatsName.' . $index, '-OQv', 'MIKROTIK-MIB');
|
||||
+ $sensors[] = new WirelessSensor(
|
||||
'rsrp',
|
||||
$this->getDeviceId(),
|
||||
- $sinr,
|
||||
+ '.1.3.6.1.4.1.14988.1.1.16.1.1.4.' . $index,
|
||||
'routeros',
|
||||
- 0,
|
||||
- 'Signal RSRP',
|
||||
+ $index,
|
||||
+ $intname . ': Signal RSRP',
|
||||
null
|
||||
- ),
|
||||
- ];
|
||||
+ ); // mtxrLTEModemSignalRSRP
|
||||
+ }
|
||||
+ return $sensors;
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Discover LTE SINR. This is in Dbm. Type is Dbm.
|
||||
+ * Returns an array of LibreNMS\Device\Sensor objects that have been discovered
|
||||
+ *
|
||||
+ * @return array Sensors
|
||||
+ */
|
||||
public function discoverWirelessSinr()
|
||||
{
|
||||
- $sinr = '.1.3.6.1.4.1.14988.1.1.16.1.1.7.1'; //MIKROTIK-MIB::mtxrLTEModemSignalSINR
|
||||
-
|
||||
- return [
|
||||
- new WirelessSensor(
|
||||
+ $data = $this->fetchData();
|
||||
+ $sensors = [];
|
||||
+ foreach ($data as $index => $entry) {
|
||||
+ $intname = snmp_get($this->getDeviceArray(),
|
||||
+ 'mtxrInterfaceStatsName.' . $index, '-OQv', 'MIKROTIK-MIB');
|
||||
+ $sensors[] = new WirelessSensor(
|
||||
'sinr',
|
||||
$this->getDeviceId(),
|
||||
- $sinr,
|
||||
+ '.1.3.6.1.4.1.14988.1.1.16.1.1.7.' . $index,
|
||||
'routeros',
|
||||
- 0,
|
||||
- 'Signal SINR',
|
||||
+ $index,
|
||||
+ $intname . ': Signal SINR',
|
||||
null
|
||||
- ),
|
||||
- ];
|
||||
+ ); // mtxrLTEModemSignalSINR
|
||||
+ }
|
||||
+ return $sensors;
|
||||
}
|
||||
|
||||
public function pollOS()
|
Loading…
Reference in New Issue
Block a user