Skip to content

Commit

Permalink
Improved support for Racom Ray radios (#9279)
Browse files Browse the repository at this point in the history
* update os polling for ray

I changed hardware detection, because in old format i got a hostname instead of hardware. I added features tab also.

* Added wireless rate sensors

I added sensors for Netbitrate and Maxbirate

* deleted old ray.png

* added better resolution logo for ray

* Update Ray.php

* Delete ray.png

* Add files via upload

* Delete ray.svg

* added ray.svg logo

* update ray.snmprec

* Update Ray.php

* Updated json test data

* added state support for RAy Radios

* Update ray.snmprec
  • Loading branch information
jozefrebjak authored and murrant committed Oct 22, 2018
1 parent 3fcf51d commit d111bd9
Show file tree
Hide file tree
Showing 7 changed files with 661 additions and 10 deletions.
17 changes: 17 additions & 0 deletions LibreNMS/OS/Ray.php
Expand Up @@ -32,13 +32,15 @@
use LibreNMS\Interfaces\Discovery\Sensors\WirelessPowerDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRssiDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessSnrDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRateDiscovery;
use LibreNMS\OS;

class Ray extends OS implements
ProcessorDiscovery,
WirelessFrequencyDiscovery,
WirelessPowerDiscovery,
WirelessRssiDiscovery,
WirelessRateDiscovery,
WirelessSnrDiscovery
{
/**
Expand Down Expand Up @@ -120,4 +122,19 @@ public function discoverWirelessSnr()
new WirelessSensor('snr', $this->getDeviceId(), $oid, 'racom', 1, 'CINR', null, 1, 10),
);
}
/**
* Discover wireless RATE. This is in bps. Type is rate.
* Returns an array of LibreNMS\Device\Sensor objects that have been discovered
*
* @return array Sensors
*/
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
return array(
new WirelessSensor('rate', $this->getDeviceId(), $oid_bitrate, 'racom-netBitrate', 1, 'Net Bitrate', null, 1000, 1),
new WirelessSensor('rate', $this->getDeviceId(), $oid_maxbitrate, 'racom-maxNetBitrate', 2, 'Net Bitrate', null, 1000, 1),
);
}
}
Binary file removed html/images/os/ray.png
Binary file not shown.
2 changes: 2 additions & 0 deletions html/images/os/ray.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
158 changes: 158 additions & 0 deletions includes/discovery/sensors/state/ray.inc.php
@@ -0,0 +1,158 @@
<?php

echo 'RAy Racom State';

// System Status (Value : na (0) unknown, ok (1) ok, warning (2) warning, alarm (3) alarm)
$state = snmp_get($device, "systemStatus.0", "-Ovqe", 'RAY-MIB');
if ($state) {
//Create State Index
$state_name = 'systemStatus';
create_state_index(
$state_name,
array(
array('value' => 0, 'generic' => 3, 'graph' => 0, 'descr' => 'Unknown'),
array('value' => 1, 'generic' => 0, 'graph' => 0, 'descr' => 'Ok'),
array('value' => 2, 'generic' => 2, 'graph' => 0, 'descr' => 'Warning'),
array('value' => 3, 'generic' => 3, 'graph' => 0, 'descr' => 'Alarm'),
)
);

$sensor_index = 0;
discover_sensor(
$valid['sensor'],
'state',
$device,
'.1.3.6.1.4.1.33555.1.1.3.1',
$sensor_index,
$state_name,
'System Status',
1,
1,
null,
null,
null,
null,
$state,
'snmp',
0
);

//Create Sensor To State Index
create_sensor_to_state_index($device, $state_name, $sensor_index);
}

// Line Status (Value : na (0) unknown, ok (1) ok, analyzer (2) analyzer, connecting (3) connecting, searching (4)). Supported by RAy10 only.
$state = snmp_get($device, "lineStatus.0", "-Ovqe", 'RAY-MIB');
if ($state) {
//Create State Index
$state_name = 'lineStatus';
create_state_index(
$state_name,
array(
array('value' => 0, 'generic' => 3, 'graph' => 0, 'descr' => 'Unknown'),
array('value' => 1, 'generic' => 0, 'graph' => 0, 'descr' => 'Ok'),
array('value' => 2, 'generic' => 2, 'graph' => 0, 'descr' => 'Analyzer'),
array('value' => 3, 'generic' => 2, 'graph' => 0, 'descr' => 'Connecting'),
array('value' => 4, 'generic' => 3, 'graph' => 0, 'descr' => 'Searching'),
)
);

$sensor_index = 1;
discover_sensor(
$valid['sensor'],
'state',
$device,
'.1.3.6.1.4.1.33555.1.1.3.2',
$sensor_index,
$state_name,
'Radio Link Status',
1,
1,
null,
null,
null,
null,
$state,
'snmp',
0
);

//Create Sensor To State Index
create_sensor_to_state_index($device, $state_name, $sensor_index);
}

// RF Power Status (Value : na (0) unknown, ok (1) ok, fail (2) fail)
$state = snmp_get($device, "rfPowerStatus.0", "-Ovqe", 'RAY-MIB');
if ($state) {
//Create State Index
$state_name = 'rfPowerStatus';
create_state_index(
$state_name,
array(
array('value' => 0, 'generic' => 3, 'graph' => 0, 'descr' => 'Unknown'),
array('value' => 1, 'generic' => 0, 'graph' => 0, 'descr' => 'Ok'),
array('value' => 2, 'generic' => 3, 'graph' => 0, 'descr' => 'Failure'),
)
);

$sensor_index = 2;
discover_sensor(
$valid['sensor'],
'state',
$device,
'.1.3.6.1.4.1.33555.1.1.3.4',
$sensor_index,
$state_name,
'RF Power Status',
1,
1,
null,
null,
null,
null,
$state,
'snmp',
0
);

//Create Sensor To State Index
create_sensor_to_state_index($device, $state_name, $sensor_index);
}

// Peer station user Ethernet link Status (Value : na (0) unknown, up (1) up, down (2) down) Not supported by RAy2.
$state = snmp_get($device, "ethPeer.0", "-Ovqe", 'RAY-MIB');
if ($state) {
//Create State Index
$state_name = 'ethPeer';
create_state_index(
$state_name,
array(
array('value' => 0, 'generic' => 3, 'graph' => 0, 'descr' => 'Unknown'),
array('value' => 1, 'generic' => 0, 'graph' => 0, 'descr' => 'Up'),
array('value' => 2, 'generic' => 3, 'graph' => 0, 'descr' => 'Down'),
)
);

$sensor_index = 3;
discover_sensor(
$valid['sensor'],
'state',
$device,
'.1.3.6.1.4.1.33555.1.1.3.6',
$sensor_index,
$state_name,
'Peer Station Ethernet Status',
1,
1,
null,
null,
null,
null,
$state,
'snmp',
0
);

//Create Sensor To State Index
create_sensor_to_state_index($device, $state_name, $sensor_index);
}
7 changes: 3 additions & 4 deletions includes/polling/os/ray.inc.php
@@ -1,8 +1,7 @@
<?php


$ray_tmp = snmp_get_multi_oid($device, 'deviceName swVer serialNumber', '-OQs', 'RAY-MIB');
$hardware = $ray_tmp['deviceName'];
$ray_tmp = snmp_get_multi_oid($device, 'productName swVer serialNumber unitType', '-OQs', 'RAY-MIB');
$hardware = $ray_tmp['productName'];
$version = $ray_tmp['swVer'];
$serial = $ray_tmp['serialNumber'];
$features = $ray_tmp['unitType'];
unset($ray_tmp);

0 comments on commit d111bd9

Please sign in to comment.