Skip to content

Commit

Permalink
Fix discovery and pooling Racom Ray2 (librenms#13553)
Browse files Browse the repository at this point in the history
* Fix discovery and pooling

* Added test data

* Removed author

* Fix

* Discovery transcribed into json

* Fix

* Fix2

* Fix3
  • Loading branch information
Martin22 authored Nov 24, 2021
1 parent e32685b commit 382ef62
Show file tree
Hide file tree
Showing 10 changed files with 1,373 additions and 725 deletions.
42 changes: 8 additions & 34 deletions LibreNMS/OS/Ray.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* @link https://www.librenms.org
*
* @copyright 2017 Tony Murray
* @author Tony Murray <[email protected]>
*/

namespace LibreNMS\OS;

use LibreNMS\Device\Processor;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\ProcessorDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessFrequencyDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessPowerDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRateDiscovery;
Expand All @@ -36,33 +31,12 @@
use LibreNMS\OS;

class Ray extends OS implements
ProcessorDiscovery,
WirelessFrequencyDiscovery,
WirelessPowerDiscovery,
WirelessRssiDiscovery,
WirelessRateDiscovery,
WirelessSnrDiscovery
{
/**
* Discover processors.
* Returns an array of LibreNMS\Device\Processor objects that have been discovered
*
* @return array Processors
*/
public function discoverProcessors()
{
// RAY-MIB::useCpu has no index, so it won't work in yaml

return [
Processor::discover(
$this->getName(),
$this->getDeviceId(),
'.1.3.6.1.4.1.33555.1.1.5.1',
0
),
];
}

/**
* Discover wireless frequency. This is in GHz. Type is frequency.
* Returns an array of LibreNMS\Device\Sensor objects that have been discovered
Expand All @@ -73,9 +47,9 @@ public function discoverWirelessFrequency()
{
return [
// RAY-MIB::txFreq.0
new WirelessSensor('frequency', $this->getDeviceId(), '.1.3.6.1.4.1.33555.1.2.1.4', 'racom-tx', 1, 'TX Frequency', null, 1, 1000),
new WirelessSensor('frequency', $this->getDeviceId(), '.1.3.6.1.4.1.33555.1.2.1.4.0', 'racom-tx', 1, 'TX Frequency', null, 1, 1000),
// RAY-MIB::rxFreq.0
new WirelessSensor('frequency', $this->getDeviceId(), '.1.3.6.1.4.1.33555.1.2.1.3', 'racom-rx', 1, 'RX Frequency', null, 1, 1000),
new WirelessSensor('frequency', $this->getDeviceId(), '.1.3.6.1.4.1.33555.1.2.1.3.0', 'racom-rx', 1, 'RX Frequency', null, 1, 1000),
];
}

Expand All @@ -89,9 +63,9 @@ public function discoverWirelessPower()
{
return [
// RAY-MIB::rfPowerCurrent.0
new WirelessSensor('power', $this->getDeviceId(), '.1.3.6.1.4.1.33555.1.2.1.17', 'racom-pow-cur', 1, 'Tx Power Current'),
new WirelessSensor('power', $this->getDeviceId(), '.1.3.6.1.4.1.33555.1.2.1.17.0', 'racom-pow-cur', 1, 'Tx Power Current'),
//RAY-MIB::rfPowerConfigured.0
new WirelessSensor('power', $this->getDeviceId(), '.1.3.6.1.4.1.33555.1.2.1.12', 'racom-pow-conf', 1, 'Tx Power Configured'),
new WirelessSensor('power', $this->getDeviceId(), '.1.3.6.1.4.1.33555.1.2.1.12.0', 'racom-pow-conf', 1, 'Tx Power Configured'),
];
}

Expand All @@ -103,7 +77,7 @@ public function discoverWirelessPower()
*/
public function discoverWirelessRssi()
{
$oid = '.1.3.6.1.4.1.33555.1.3.2.1'; // RAY-MIB::rss.0
$oid = '.1.3.6.1.4.1.33555.1.3.2.1.0'; // RAY-MIB::rss.0

return [
new WirelessSensor('rssi', $this->getDeviceId(), $oid, 'racom', 1, 'RSSI', null, 1, 10),
Expand All @@ -118,7 +92,7 @@ public function discoverWirelessRssi()
*/
public function discoverWirelessSnr()
{
$oid = '.1.3.6.1.4.1.33555.1.3.2.2'; // RAY-MIB::snr.0
$oid = '.1.3.6.1.4.1.33555.1.3.2.2.0'; // RAY-MIB::snr.0

return [
new WirelessSensor('snr', $this->getDeviceId(), $oid, 'racom', 1, 'CINR', null, 1, 10),
Expand All @@ -133,8 +107,8 @@ public function discoverWirelessSnr()
*/
public function discoverWirelessRate()
{
$oid_bitrate = '.1.3.6.1.4.1.33555.1.2.1.13'; // RAY-MIB::netBitrate.0
$oid_maxbitrate = '.1.3.6.1.4.1.33555.1.2.1.14'; // RAY-MIB::maxNetBitrate.0
$oid_bitrate = '.1.3.6.1.4.1.33555.1.2.1.13.0'; // RAY-MIB::netBitrate.0
$oid_maxbitrate = '.1.3.6.1.4.1.33555.1.2.1.14.0'; // RAY-MIB::maxNetBitrate.0

return [
new WirelessSensor('rate', $this->getDeviceId(), $oid_bitrate, 'racom-netBitrate', 1, 'Net Bitrate', null, 1000, 1),
Expand Down
82 changes: 78 additions & 4 deletions includes/definitions/discovery/ray.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,80 @@
mib: RAY-MIB
modules:
os:
features: RAY-MIB::unitType
hardware: RAY-MIB::productName
serial: RAY-MIB::serialNumber
version: RAY-MIB::swVer
features: RAY-MIB::unitType.0
hardware: RAY-MIB::productName.0
serial: RAY-MIB::serialNumber.0
version: RAY-MIB::swVer.0

mempools:
data:
-
percent_used: RAY-MIB::useMemory

processors:
data:
-
oid: useCpu
num_oid: '.1.3.6.1.4.1.33555.1.1.5.1.{{ $index }}'

sensors:
voltage:
data:
-
oid: voltageUnit
num_oid: '.1.3.6.1.4.1.33555.1.1.4.3.{{ $index }}'
descr: Voltage
divisor: 10

temperature:
data:
-
oid: temperatureRadio
num_oid: '.1.3.6.1.4.1.33555.1.1.4.2.{{ $index }}'
descr: Temperature
divisor: 100

state:
data:
-
oid: systemStatus
value: systemStatus
num_oid: '.1.3.6.1.4.1.33555.1.1.3.1.{{ $index }}'
descr: System Status
states:
- { value: 0, descr: Unknown, graph: 0, generic: 3 }
- { value: 1, descr: Ok, graph: 0, generic: 0 }
- { value: 2, descr: Warning, graph: 0, generic: 2 }
- { value: 3, descr: Alarm, graph: 0, generic: 3 }

-
oid: rfPowerStatus
value: rfPowerStatus
num_oid: '.1.3.6.1.4.1.33555.1.1.3.4.{{ $index }}'
descr: RF Power Status
states:
- { value: 0, descr: Unknown, graph: 0, generic: 3 }
- { value: 1, descr: Ok, graph: 0, generic: 0 }
- { value: 2, descr: Failure, graph: 0, generic: 3 }

-
oid: lineStatus
value: lineStatus
num_oid: '.1.3.6.1.4.1.33555.1.1.3.2.{{ $index }}'
descr: Radio Link Status
states:
- { value: 0, descr: Unknown, graph: 0, generic: 3 }
- { value: 1, descr: Ok, graph: 0, generic: 0 }
- { value: 2, descr: Analyzer, graph: 0, generic: 2 }
- { value: 3, descr: Connecting, graph: 0, generic: 2 }
- { value: 4, descr: Searching, graph: 0, generic: 3 }

-
oid: ethPeer
value: ethPeer
num_oid: '.1.3.6.1.4.1.33555.1.1.3.6.{{ $index }}'
descr: Peer Station Ethernet Status
states:
- { value: 0, descr: Unknown, graph: 0, generic: 3 }
- { value: 1, descr: Up, graph: 0, generic: 0 }
- { value: 2, descr: Down, graph: 0, generic: 3 }
158 changes: 0 additions & 158 deletions includes/discovery/sensors/state/ray.inc.php

This file was deleted.

22 changes: 0 additions & 22 deletions includes/discovery/sensors/temperature/ray.inc.php

This file was deleted.

22 changes: 0 additions & 22 deletions includes/discovery/sensors/voltage/ray.inc.php

This file was deleted.

Loading

0 comments on commit 382ef62

Please sign in to comment.