mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 10:28:13 +00:00
Mikrotik wifi station mode sensors (#14193)
* add WlStat wifi sensors * test data
This commit is contained in:
parent
83126161d9
commit
e8bcbfd944
@ -83,6 +83,33 @@ class Routeros extends OS implements
|
||||
);
|
||||
}
|
||||
|
||||
$data = $this->getCacheTable('MIKROTIK-MIB::mtxrWlStatTable');
|
||||
foreach ($data as $index => $entry) {
|
||||
$freq = $entry['mtxrWlStatFreq'] ? substr($entry['mtxrWlStatFreq'], 0, 1) . 'G' : 'SSID';
|
||||
if (empty($entry['mtxrWlStatTxCCQ']) && empty($entry['mtxrWlStatRxCCQ'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$sensors[] = new WirelessSensor(
|
||||
'ccq',
|
||||
$this->getDeviceId(),
|
||||
'.1.3.6.1.4.1.14988.1.1.1.1.1.9.' . $index,
|
||||
'mikrotik-tx-ccq',
|
||||
$index,
|
||||
"$freq: " . $entry['mtxrWlStatSsid'] . ' Tx',
|
||||
$entry['mtxrWlStatTxCCQ']
|
||||
);
|
||||
$sensors[] = new WirelessSensor(
|
||||
'ccq',
|
||||
$this->getDeviceId(),
|
||||
'.1.3.6.1.4.1.14988.1.1.1.1.1.10.' . $index,
|
||||
'mikrotik-rx-ccq',
|
||||
$index,
|
||||
"$freq: " . $entry['mtxrWlStatSsid'] . ' Rx',
|
||||
$entry['mtxrWlStatRxCCQ']
|
||||
);
|
||||
}
|
||||
|
||||
return $sensors;
|
||||
}
|
||||
|
||||
@ -127,7 +154,6 @@ class Routeros extends OS implements
|
||||
continue;
|
||||
}
|
||||
$freq = substr($entry['mtxrWlApFreq'], 0, 1) . 'G';
|
||||
|
||||
$sensors[] = new WirelessSensor(
|
||||
'frequency',
|
||||
$this->getDeviceId(),
|
||||
@ -139,6 +165,23 @@ class Routeros extends OS implements
|
||||
);
|
||||
}
|
||||
|
||||
$data = $this->getCacheTable('MIKROTIK-MIB::mtxrWlStatTable');
|
||||
foreach ($data as $index => $entry) {
|
||||
if ($entry['mtxrWlStatFreq'] === '0') {
|
||||
continue;
|
||||
}
|
||||
$freq = substr($entry['mtxrWlStatFreq'], 0, 1) . 'G';
|
||||
$sensors[] = new WirelessSensor(
|
||||
'frequency',
|
||||
$this->getDeviceId(),
|
||||
'.1.3.6.1.4.1.14988.1.1.1.1.1.7.' . $index,
|
||||
'mikrotik',
|
||||
$index,
|
||||
"$freq: " . $entry['mtxrWlStatSsid'],
|
||||
$entry['mtxrWlStatFreq']
|
||||
);
|
||||
}
|
||||
|
||||
$data = $this->getCacheTable('MIKROTIK-MIB::mtxrWl60GTable');
|
||||
foreach ($data as $index => $entry) {
|
||||
$sensors[] = new WirelessSensor(
|
||||
@ -243,19 +286,21 @@ class Routeros extends OS implements
|
||||
public function discoverWirelessRate()
|
||||
{
|
||||
$sensors = [];
|
||||
|
||||
$data = $this->getCacheTable('MIKROTIK-MIB::mtxrWlApTable');
|
||||
foreach ($data as $index => $entry) {
|
||||
if ($entry['mtxrWlApTxRate'] === '0' && $entry['mtxrWlApRxRate'] === '0') {
|
||||
continue; // no data
|
||||
}
|
||||
|
||||
$freq = $entry['mtxrWlApFreq'] ? substr($entry['mtxrWlApFreq'], 0, 1) . 'G' : 'SSID';
|
||||
$sensors[] = new WirelessSensor(
|
||||
'rate',
|
||||
$this->getDeviceId(),
|
||||
'.1.3.6.1.4.1.14988.1.1.1.3.1.2.' . $index,
|
||||
'mikrotik-tx',
|
||||
$index,
|
||||
'SSID: ' . $entry['mtxrWlApSsid'] . ' Tx',
|
||||
"$freq: " . $entry['mtxrWlApSsid'] . ' Tx',
|
||||
$entry['mtxrWlApTxRate']
|
||||
);
|
||||
$sensors[] = new WirelessSensor(
|
||||
@ -264,13 +309,38 @@ class Routeros extends OS implements
|
||||
'.1.3.6.1.4.1.14988.1.1.1.3.1.3.' . $index,
|
||||
'mikrotik-rx',
|
||||
$index,
|
||||
'SSID: ' . $entry['mtxrWlApSsid'] . ' Rx',
|
||||
"$freq: " . $entry['mtxrWlApSsid'] . ' Rx',
|
||||
$entry['mtxrWlApRxRate']
|
||||
);
|
||||
}
|
||||
|
||||
$data = $this->getCacheTable('MIKROTIK-MIB::mtxrWl60GTable');
|
||||
$data = $this->getCacheTable('MIKROTIK-MIB::mtxrWlStatTable');
|
||||
foreach ($data as $index => $entry) {
|
||||
if ($entry['mtxrWlStatTxRate'] === '0' && $entry['mtxrWlStatRxRate'] === '0') {
|
||||
continue; // no data
|
||||
}
|
||||
$freq = $entry['mtxrWlStatFreq'] ? substr($entry['mtxrWlStatFreq'], 0, 1) . 'G' : 'SSID';
|
||||
$sensors[] = new WirelessSensor(
|
||||
'rate',
|
||||
$this->getDeviceId(),
|
||||
'.1.3.6.1.4.1.14988.1.1.1.1.1.2.' . $index,
|
||||
'mikrotik-tx',
|
||||
$index,
|
||||
"$freq: " . $entry['mtxrWlStatSsid'] . ' Tx',
|
||||
$entry['mtxrWlStatTxRate']
|
||||
);
|
||||
$sensors[] = new WirelessSensor(
|
||||
'rate',
|
||||
$this->getDeviceId(),
|
||||
'.1.3.6.1.4.1.14988.1.1.1.1.1.3.' . $index,
|
||||
'mikrotik-rx',
|
||||
$index,
|
||||
"$freq: " . $entry['mtxrWlStatSsid'] . ' Rx',
|
||||
$entry['mtxrWlStatRxRate']
|
||||
);
|
||||
}
|
||||
|
||||
$data = $this->getCacheTable('MIKROTIK-MIB::mtxrWl60GTable');
|
||||
foreach ($data as $index => $entry) {
|
||||
$sensors[] = new WirelessSensor(
|
||||
'rate',
|
||||
|
243
tests/data/routeros_station.json
Normal file
243
tests/data/routeros_station.json
Normal file
@ -0,0 +1,243 @@
|
||||
{
|
||||
"os": {
|
||||
"discovery": {
|
||||
"devices": [
|
||||
{
|
||||
"sysName": "<private>",
|
||||
"sysObjectID": ".1.3.6.1.4.1.14988.1",
|
||||
"sysDescr": "RouterOS RBDynaDishG-5HacD",
|
||||
"sysContact": null,
|
||||
"version": null,
|
||||
"hardware": "RBDynaDishG-5HacD",
|
||||
"features": null,
|
||||
"os": "routeros",
|
||||
"type": "network",
|
||||
"serial": null,
|
||||
"icon": "mikrotik.svg",
|
||||
"location": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"poller": "matches discovery"
|
||||
},
|
||||
"wireless": {
|
||||
"discovery": {
|
||||
"wireless_sensors": [
|
||||
{
|
||||
"sensor_deleted": 0,
|
||||
"sensor_class": "rate",
|
||||
"sensor_index": "23",
|
||||
"sensor_type": "mikrotik-tx",
|
||||
"sensor_descr": "5G: pikjo88 Tx",
|
||||
"sensor_divisor": 1,
|
||||
"sensor_multiplier": 1,
|
||||
"sensor_aggregator": "sum",
|
||||
"sensor_current": 150000000,
|
||||
"sensor_prev": null,
|
||||
"sensor_limit": null,
|
||||
"sensor_limit_warn": null,
|
||||
"sensor_limit_low": null,
|
||||
"sensor_limit_low_warn": null,
|
||||
"sensor_alert": 1,
|
||||
"sensor_custom": "No",
|
||||
"entPhysicalIndex": null,
|
||||
"entPhysicalIndex_measured": null,
|
||||
"sensor_oids": "[\".1.3.6.1.4.1.14988.1.1.1.1.1.2.23\"]"
|
||||
},
|
||||
{
|
||||
"sensor_deleted": 0,
|
||||
"sensor_class": "rate",
|
||||
"sensor_index": "23",
|
||||
"sensor_type": "mikrotik-rx",
|
||||
"sensor_descr": "5G: pikjo88 Rx",
|
||||
"sensor_divisor": 1,
|
||||
"sensor_multiplier": 1,
|
||||
"sensor_aggregator": "sum",
|
||||
"sensor_current": 90000000,
|
||||
"sensor_prev": null,
|
||||
"sensor_limit": null,
|
||||
"sensor_limit_warn": null,
|
||||
"sensor_limit_low": null,
|
||||
"sensor_limit_low_warn": null,
|
||||
"sensor_alert": 1,
|
||||
"sensor_custom": "No",
|
||||
"entPhysicalIndex": null,
|
||||
"entPhysicalIndex_measured": null,
|
||||
"sensor_oids": "[\".1.3.6.1.4.1.14988.1.1.1.1.1.3.23\"]"
|
||||
},
|
||||
{
|
||||
"sensor_deleted": 0,
|
||||
"sensor_class": "ccq",
|
||||
"sensor_index": "23",
|
||||
"sensor_type": "mikrotik-tx-ccq",
|
||||
"sensor_descr": "5G: pikjo88 Tx",
|
||||
"sensor_divisor": 1,
|
||||
"sensor_multiplier": 1,
|
||||
"sensor_aggregator": "sum",
|
||||
"sensor_current": 100,
|
||||
"sensor_prev": null,
|
||||
"sensor_limit": null,
|
||||
"sensor_limit_warn": null,
|
||||
"sensor_limit_low": null,
|
||||
"sensor_limit_low_warn": null,
|
||||
"sensor_alert": 1,
|
||||
"sensor_custom": "No",
|
||||
"entPhysicalIndex": null,
|
||||
"entPhysicalIndex_measured": null,
|
||||
"sensor_oids": "[\".1.3.6.1.4.1.14988.1.1.1.1.1.9.23\"]"
|
||||
},
|
||||
{
|
||||
"sensor_deleted": 0,
|
||||
"sensor_class": "ccq",
|
||||
"sensor_index": "23",
|
||||
"sensor_type": "mikrotik-rx-ccq",
|
||||
"sensor_descr": "5G: pikjo88 Rx",
|
||||
"sensor_divisor": 1,
|
||||
"sensor_multiplier": 1,
|
||||
"sensor_aggregator": "sum",
|
||||
"sensor_current": 80,
|
||||
"sensor_prev": null,
|
||||
"sensor_limit": null,
|
||||
"sensor_limit_warn": null,
|
||||
"sensor_limit_low": null,
|
||||
"sensor_limit_low_warn": null,
|
||||
"sensor_alert": 1,
|
||||
"sensor_custom": "No",
|
||||
"entPhysicalIndex": null,
|
||||
"entPhysicalIndex_measured": null,
|
||||
"sensor_oids": "[\".1.3.6.1.4.1.14988.1.1.1.1.1.10.23\"]"
|
||||
},
|
||||
{
|
||||
"sensor_deleted": 0,
|
||||
"sensor_class": "frequency",
|
||||
"sensor_index": "23",
|
||||
"sensor_type": "mikrotik",
|
||||
"sensor_descr": "5G: pikjo88",
|
||||
"sensor_divisor": 1,
|
||||
"sensor_multiplier": 1,
|
||||
"sensor_aggregator": "sum",
|
||||
"sensor_current": 5745,
|
||||
"sensor_prev": null,
|
||||
"sensor_limit": null,
|
||||
"sensor_limit_warn": null,
|
||||
"sensor_limit_low": null,
|
||||
"sensor_limit_low_warn": null,
|
||||
"sensor_alert": 1,
|
||||
"sensor_custom": "No",
|
||||
"entPhysicalIndex": null,
|
||||
"entPhysicalIndex_measured": null,
|
||||
"sensor_oids": "[\".1.3.6.1.4.1.14988.1.1.1.1.1.7.23\"]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"poller": {
|
||||
"wireless_sensors": [
|
||||
{
|
||||
"sensor_deleted": 0,
|
||||
"sensor_class": "rate",
|
||||
"sensor_index": "23",
|
||||
"sensor_type": "mikrotik-tx",
|
||||
"sensor_descr": "5G: pikjo88 Tx",
|
||||
"sensor_divisor": 1,
|
||||
"sensor_multiplier": 1,
|
||||
"sensor_aggregator": "sum",
|
||||
"sensor_current": 150000000,
|
||||
"sensor_prev": 150000000,
|
||||
"sensor_limit": null,
|
||||
"sensor_limit_warn": null,
|
||||
"sensor_limit_low": null,
|
||||
"sensor_limit_low_warn": null,
|
||||
"sensor_alert": 1,
|
||||
"sensor_custom": "No",
|
||||
"entPhysicalIndex": null,
|
||||
"entPhysicalIndex_measured": null,
|
||||
"sensor_oids": "[\".1.3.6.1.4.1.14988.1.1.1.1.1.2.23\"]"
|
||||
},
|
||||
{
|
||||
"sensor_deleted": 0,
|
||||
"sensor_class": "rate",
|
||||
"sensor_index": "23",
|
||||
"sensor_type": "mikrotik-rx",
|
||||
"sensor_descr": "5G: pikjo88 Rx",
|
||||
"sensor_divisor": 1,
|
||||
"sensor_multiplier": 1,
|
||||
"sensor_aggregator": "sum",
|
||||
"sensor_current": 90000000,
|
||||
"sensor_prev": 90000000,
|
||||
"sensor_limit": null,
|
||||
"sensor_limit_warn": null,
|
||||
"sensor_limit_low": null,
|
||||
"sensor_limit_low_warn": null,
|
||||
"sensor_alert": 1,
|
||||
"sensor_custom": "No",
|
||||
"entPhysicalIndex": null,
|
||||
"entPhysicalIndex_measured": null,
|
||||
"sensor_oids": "[\".1.3.6.1.4.1.14988.1.1.1.1.1.3.23\"]"
|
||||
},
|
||||
{
|
||||
"sensor_deleted": 0,
|
||||
"sensor_class": "ccq",
|
||||
"sensor_index": "23",
|
||||
"sensor_type": "mikrotik-tx-ccq",
|
||||
"sensor_descr": "5G: pikjo88 Tx",
|
||||
"sensor_divisor": 1,
|
||||
"sensor_multiplier": 1,
|
||||
"sensor_aggregator": "sum",
|
||||
"sensor_current": 100,
|
||||
"sensor_prev": 100,
|
||||
"sensor_limit": null,
|
||||
"sensor_limit_warn": null,
|
||||
"sensor_limit_low": null,
|
||||
"sensor_limit_low_warn": null,
|
||||
"sensor_alert": 1,
|
||||
"sensor_custom": "No",
|
||||
"entPhysicalIndex": null,
|
||||
"entPhysicalIndex_measured": null,
|
||||
"sensor_oids": "[\".1.3.6.1.4.1.14988.1.1.1.1.1.9.23\"]"
|
||||
},
|
||||
{
|
||||
"sensor_deleted": 0,
|
||||
"sensor_class": "ccq",
|
||||
"sensor_index": "23",
|
||||
"sensor_type": "mikrotik-rx-ccq",
|
||||
"sensor_descr": "5G: pikjo88 Rx",
|
||||
"sensor_divisor": 1,
|
||||
"sensor_multiplier": 1,
|
||||
"sensor_aggregator": "sum",
|
||||
"sensor_current": 80,
|
||||
"sensor_prev": 80,
|
||||
"sensor_limit": null,
|
||||
"sensor_limit_warn": null,
|
||||
"sensor_limit_low": null,
|
||||
"sensor_limit_low_warn": null,
|
||||
"sensor_alert": 1,
|
||||
"sensor_custom": "No",
|
||||
"entPhysicalIndex": null,
|
||||
"entPhysicalIndex_measured": null,
|
||||
"sensor_oids": "[\".1.3.6.1.4.1.14988.1.1.1.1.1.10.23\"]"
|
||||
},
|
||||
{
|
||||
"sensor_deleted": 0,
|
||||
"sensor_class": "frequency",
|
||||
"sensor_index": "23",
|
||||
"sensor_type": "mikrotik",
|
||||
"sensor_descr": "5G: pikjo88",
|
||||
"sensor_divisor": 1,
|
||||
"sensor_multiplier": 1,
|
||||
"sensor_aggregator": "sum",
|
||||
"sensor_current": 5745,
|
||||
"sensor_prev": 5745,
|
||||
"sensor_limit": null,
|
||||
"sensor_limit_warn": null,
|
||||
"sensor_limit_low": null,
|
||||
"sensor_limit_low_warn": null,
|
||||
"sensor_alert": 1,
|
||||
"sensor_custom": "No",
|
||||
"entPhysicalIndex": null,
|
||||
"entPhysicalIndex_measured": null,
|
||||
"sensor_oids": "[\".1.3.6.1.4.1.14988.1.1.1.1.1.7.23\"]"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
12
tests/snmpsim/routeros_station.snmprec
Normal file
12
tests/snmpsim/routeros_station.snmprec
Normal file
@ -0,0 +1,12 @@
|
||||
1.3.6.1.2.1.1.1.0|4|RouterOS RBDynaDishG-5HacD
|
||||
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.14988.1
|
||||
1.3.6.1.2.1.1.5.0|4|<private>
|
||||
1.3.6.1.4.1.14988.1.1.1.1.1.2.23|66|150000000
|
||||
1.3.6.1.4.1.14988.1.1.1.1.1.3.23|66|90000000
|
||||
1.3.6.1.4.1.14988.1.1.1.1.1.4.23|2|-47
|
||||
1.3.6.1.4.1.14988.1.1.1.1.1.5.23|4|pikjo88
|
||||
1.3.6.1.4.1.14988.1.1.1.1.1.6.23|4x|00804870703F
|
||||
1.3.6.1.4.1.14988.1.1.1.1.1.7.23|2|5745
|
||||
1.3.6.1.4.1.14988.1.1.1.1.1.8.23|4|5745/20-Ce/an
|
||||
1.3.6.1.4.1.14988.1.1.1.1.1.9.23|65|100
|
||||
1.3.6.1.4.1.14988.1.1.1.1.1.10.23|65|80
|
Loading…
Reference in New Issue
Block a user