Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Radwin OS Wireless Sensors #8372

Merged
merged 6 commits into from Mar 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
85 changes: 85 additions & 0 deletions LibreNMS/OS/Radwin.php
@@ -0,0 +1,85 @@
<?php
/**
* Radwin.php
*
* Radwin
*
* 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 <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2018 Vivia Nguyen-Tran
* @author Vivia Nguyen-Tran<nguyen_vivia@hotmail.com>
*/

namespace LibreNMS\OS;

use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessDistanceDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessPowerDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRssiDiscovery;
use LibreNMS\OS;

class Radwin extends OS implements
WirelessDistanceDiscovery,
WirelessPowerDiscovery,
WirelessRssiDiscovery
{
/**
* Discover wireless distance. This is in Kilometers. Type is distance.
* Returns an array of LibreNMS\Device\Sensor objects that have been discovered
*
* @return array Sensors
*/
public function discoverWirelessDistance()
{
$oid = '.1.3.6.1.4.1.4458.1000.1.5.29.0'; //RADWIN-MIB-WINLINK1000::winlink1000OduAirLinkDistance.0
return array(
new WirelessSensor('distance', $this->getDeviceId(), $oid, 'radwin', 0, 'Link distance', null, 1, 1000)
);
}

/**
* Discover wireless tx or rx power. This is in dBm. Type is power.
* Returns an array of LibreNMS\Device\Sensor objects that have been discovered
*
* @return array
*/

public function discoverWirelessPower()
{
$transmit = '.1.3.6.1.4.1.4458.1000.1.5.4.0'; //RADWIN-MIB-WINLINK1000::winlink1000OduAirTxPower.0
$receive = '.1.3.6.1.4.1.4458.1000.1.5.9.1.0'; //RADWIN-MIB-WINLINK1000::winlink1000OduAirRxPower.0

return array(
new WirelessSensor('power', $this->getDeviceId(), $transmit, 'Radwin-Tx', 0, 'Tx Power'),
new WirelessSensor('power', $this->getDeviceId(), $receive, 'Radwin-Rx', 0, 'Rx Power')
);
}

/**
* Discover wireless RSSI (Received Signal Strength Indicator). This is in dBm. Type is rssi.
* Returns an array of LibreNMS\Device\Sensor objects that have been discovered
*
* @return array
*/

public function discoverWirelessRssi()
{
$oid = '.1.3.6.1.4.1.4458.1000.1.1.51.7.0'; // RADWIN-MIB-WINLINK1000::winlink1000OduAdmWifiRssi.0
return array(
new WirelessSensor('rssi', $this->getDeviceId(), $oid, 'radwin', 0, 'RSSI')
);
}
}
180 changes: 180 additions & 0 deletions tests/data/radwin_5200-0150.json
@@ -0,0 +1,180 @@
{
"wireless": {
"discovery": {
"wireless_sensors": [
{
"sensor_deleted": "0",
"sensor_class": "rssi",
"sensor_index": "0",
"sensor_type": "radwin",
"sensor_descr": "RSSI",
"sensor_divisor": "1",
"sensor_multiplier": "1",
"sensor_aggregator": "sum",
"sensor_current": "-150",
"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.4458.1000.1.1.51.7.0\"]"
},
{
"sensor_deleted": "0",
"sensor_class": "power",
"sensor_index": "0",
"sensor_type": "Radwin-Tx",
"sensor_descr": "Tx Power",
"sensor_divisor": "1",
"sensor_multiplier": "1",
"sensor_aggregator": "sum",
"sensor_current": "3",
"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.4458.1000.1.5.4.0\"]"
},
{
"sensor_deleted": "0",
"sensor_class": "power",
"sensor_index": "0",
"sensor_type": "Radwin-Rx",
"sensor_descr": "Rx Power",
"sensor_divisor": "1",
"sensor_multiplier": "1",
"sensor_aggregator": "sum",
"sensor_current": "-67",
"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.4458.1000.1.5.9.1.0\"]"
},
{
"sensor_deleted": "0",
"sensor_class": "distance",
"sensor_index": "0",
"sensor_type": "radwin",
"sensor_descr": "Link distance",
"sensor_divisor": "1000",
"sensor_multiplier": "1",
"sensor_aggregator": "sum",
"sensor_current": "0.3",
"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.4458.1000.1.5.29.0\"]"
}
]
},
"poller": {
"wireless_sensors": [
{
"sensor_deleted": "0",
"sensor_class": "rssi",
"sensor_index": "0",
"sensor_type": "radwin",
"sensor_descr": "RSSI",
"sensor_divisor": "1",
"sensor_multiplier": "1",
"sensor_aggregator": "sum",
"sensor_current": "-150",
"sensor_prev": "-150",
"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.4458.1000.1.1.51.7.0\"]"
},
{
"sensor_deleted": "0",
"sensor_class": "power",
"sensor_index": "0",
"sensor_type": "Radwin-Tx",
"sensor_descr": "Tx Power",
"sensor_divisor": "1",
"sensor_multiplier": "1",
"sensor_aggregator": "sum",
"sensor_current": "3",
"sensor_prev": "3",
"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.4458.1000.1.5.4.0\"]"
},
{
"sensor_deleted": "0",
"sensor_class": "power",
"sensor_index": "0",
"sensor_type": "Radwin-Rx",
"sensor_descr": "Rx Power",
"sensor_divisor": "1",
"sensor_multiplier": "1",
"sensor_aggregator": "sum",
"sensor_current": "-67",
"sensor_prev": "-67",
"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.4458.1000.1.5.9.1.0\"]"
},
{
"sensor_deleted": "0",
"sensor_class": "distance",
"sensor_index": "0",
"sensor_type": "radwin",
"sensor_descr": "Link distance",
"sensor_divisor": "1000",
"sensor_multiplier": "1",
"sensor_aggregator": "sum",
"sensor_current": "0.3",
"sensor_prev": "0.3",
"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.4458.1000.1.5.29.0\"]"
}
]
}
}
}