Paul Heinrichs 0dd3ec25d3 device: Update Cambium devices to the new wireless sensors (#7703)
* Inital cambium refactor

* Refactored tests

* Remove CMM from pmp group

* Add sensors / Give CMM individual OS

* Fix linting

* More Sensors / states and Revised Headers

* Added old graphs / more sensors

* Add modulation rate to sensor

* Fix Hardware detection bug

* Further hardware detection refinments

* Modify pmp hardware detection

* New Wireless Metric - SSR

* SSR Sensor Graph

* Migrate SSR to metric

* Added last metric file

* Add master check to isAp method

* Fix variables in epmp

* CMM Discovery and state addition

* Add another test for cmm
2017-12-06 21:36:01 +00:00

132 lines
3.8 KiB
PHP

<?php
/**
* Epmp.php
*
* Cambium
*
* 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 2017 Paul Heinrichs
* @author Paul Heinrichs<pdheinrichs@gmail.com>
*/
namespace LibreNMS\OS;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRssiDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessSnrDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessFrequencyDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessClientsDiscovery;
use LibreNMS\OS;
class Epmp extends OS implements
WirelessRssiDiscovery,
WirelessSnrDiscovery,
WirelessFrequencyDiscovery,
WirelessClientsDiscovery
{
/**
* Discover wireless bit/packet error ratio. This is in percent. Type is error-ratio.
* Returns an array of LibreNMS\Device\Sensor objects that have been discovered
*
* @return array Sensors
*/
public function discoverWirelessRssi()
{
$rssi_oid = '.1.3.6.1.4.1.17713.21.1.2.3.0'; //CAMBIUM-PMP80211-MIB::cambiumSTADLRSSI.0
return array(
new WirelessSensor(
'rssi',
$this->getDeviceId(),
$rssi_oid,
'epmp',
0,
'Cambium ePMP RSSI',
null
)
);
}
/**
* Discover wireless SNR. This is in dB. Type is snr.
* Formula: SNR = Signal or Rx Power - Noise Floor
* Returns an array of LibreNMS\Device\Sensor objects that have been discovered
*
* @return array Sensors
*/
public function discoverWirelessSnr()
{
$snr = '.1.3.6.1.4.1.17713.21.1.2.18.0'; //CAMBIUM-PMP80211-MIB::cambiumSTADLSNR.0
return array(
new WirelessSensor(
'snr',
$this->getDeviceId(),
$snr,
'epmp',
0,
'Cambium ePMP SNR',
null
)
);
}
/**
* Discover wireless frequency. This is in MHz. Type is frequency.
* Returns an array of LibreNMS\Device\Sensor objects that have been discovered
*
* @return array Sensors
*/
public function discoverWirelessFrequency()
{
$frequency = '.1.3.6.1.4.1.17713.21.1.2.1.0'; //CAMBIUM-PMP80211-MIB::cambiumSTAConnectedRFFrequency"
return array(
new WirelessSensor(
'frequency',
$this->getDeviceId(),
$frequency,
'epmp',
0,
'Cambium ePMP Frequency',
null
)
);
}
/**
* Discover wireless client counts. Type is clients.
* Returns an array of LibreNMS\Device\Sensor objects that have been discovered
*
* @return array Sensors
*/
public function discoverWirelessClients()
{
$registeredSM = '.1.3.6.1.4.1.17713.21.1.2.10.0'; //CAMBIUM-PMP80211-MIB::cambiumAPNumberOfConnectedSTA.0
return array(
new WirelessSensor(
'clients',
$this->getDeviceId(),
$registeredSM,
'epmp',
0,
'Client Count',
null
)
);
}
}