From d9169c684232b918bea72121abbdcde543f0c13a Mon Sep 17 00:00:00 2001 From: Paul Heinrichs Date: Tue, 26 Dec 2017 05:03:23 -0500 Subject: [PATCH] device: Cambium cnPilot Support (#7898) * Cambium cnPilot Support * Requested changes * Update MIB dir and snmp_get method * Fixed assigned var * Add SysObjectId in tests --- LibreNMS/OS/Cnpilote.php | 98 ++ includes/definitions/cnpilote.yaml | 12 + includes/definitions/cnpilotr.yaml | 12 + includes/polling/os/cnpilote.inc.php | 17 + includes/polling/os/cnpilotr.inc.php | 16 + mibs/cambium/cnpilote/CAMBIUM-MIB | 839 ++++++++++++ mibs/cambium/cnpilotr/CAMBIUM-MIB | 1894 ++++++++++++++++++++++++++ tests/snmpsim/cnpilote.snmprec | 2 + tests/snmpsim/cnpilotr_1.snmprec | 2 + tests/snmpsim/cnpilotr_2.snmprec | 2 + tests/snmpsim/cnpilotr_3.snmprec | 2 + 11 files changed, 2896 insertions(+) create mode 100644 LibreNMS/OS/Cnpilote.php create mode 100644 includes/definitions/cnpilote.yaml create mode 100644 includes/definitions/cnpilotr.yaml create mode 100644 includes/polling/os/cnpilote.inc.php create mode 100644 includes/polling/os/cnpilotr.inc.php create mode 100644 mibs/cambium/cnpilote/CAMBIUM-MIB create mode 100644 mibs/cambium/cnpilotr/CAMBIUM-MIB create mode 100644 tests/snmpsim/cnpilote.snmprec create mode 100644 tests/snmpsim/cnpilotr_1.snmprec create mode 100644 tests/snmpsim/cnpilotr_2.snmprec create mode 100644 tests/snmpsim/cnpilotr_3.snmprec diff --git a/LibreNMS/OS/Cnpilote.php b/LibreNMS/OS/Cnpilote.php new file mode 100644 index 0000000000..75ff549064 --- /dev/null +++ b/LibreNMS/OS/Cnpilote.php @@ -0,0 +1,98 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2017 Paul Heinrichs + * @author Paul Heinrichs + */ + +namespace LibreNMS\OS; + +use LibreNMS\Device\WirelessSensor; +use LibreNMS\Interfaces\Discovery\Sensors\WirelessClientsDiscovery; +use LibreNMS\Interfaces\Discovery\Sensors\WirelessSnrDiscovery; +use LibreNMS\Interfaces\Discovery\Sensors\WirelessPowerDiscovery; +use LibreNMS\Interfaces\Discovery\Sensors\WirelessNoiseFloorDiscovery; +use LibreNMS\OS; + +class Cnpilote extends OS implements + WirelessClientsDiscovery, + WirelessSnrDiscovery, + WirelessPowerDiscovery, + WirelessNoiseFloorDiscovery +{ + + /** + * 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() + { + $oid = '.1.3.6.1.4.1.17713.22.1.1.1.14.0'; //CAMBIUM-MIB::cambiumAPTotalClients.0 + return array( + new WirelessSensor('clients', $this->getDeviceId(), $oid, 'cnpilot', 1, 'Clients') + ); + } + + /** + * 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() + { + $oid = '.1.3.6.1.4.1.17713.22.1.3.1.11.0'; //CAMBIUM-MIB::cambiumClientSNR.0 + return array( + new WirelessSensor('snr', $this->getDeviceId(), $oid, 'cnpilot', 1, 'SNR') + ); + } + + /** + * 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() + { + $oid = '.1.3.6.1.4.1.17713.22.1.2.1.8.0'; //CAMBIUM-MIB::cambiumRadioTransmitPower.0 + return array( + new WirelessSensor('power', $this->getDeviceId(), $oid, 'cnpilot', 1, 'Transmit Power') + ); + } + + /** + * Discover wireless noise floor. This is in dBm/Hz. Type is noise-floor. + * Returns an array of LibreNMS\Device\Sensor objects that have been discovered + * + * @return array + */ + public function discoverWirelessNoiseFloor() + { + $oid = '.1.3.6.1.4.1.17713.22.1.2.1.16.0'; //CAMBIUM-MIB::cambiumRadioNoiseFloor.0 + return array( + new WirelessSensor('noise-floor', $this->getDeviceId(), $oid, 'cnpilot', 1, 'Radio Noise Floor') + ); + } +} diff --git a/includes/definitions/cnpilote.yaml b/includes/definitions/cnpilote.yaml new file mode 100644 index 0000000000..e382993137 --- /dev/null +++ b/includes/definitions/cnpilote.yaml @@ -0,0 +1,12 @@ +os: cnpilote +text: Cambium cnPilot +type: wireless +icon: cambium +mib_dir: cambium\cnpilote +over: + - { graph: device_bits, text: 'Device Traffic' } + - { graph: device_wireless_clients, text: 'Number of Clients' } +group: cambium +discovery: + - sysObjectId: + - .1.3.6.1.4.1.17713.22 \ No newline at end of file diff --git a/includes/definitions/cnpilotr.yaml b/includes/definitions/cnpilotr.yaml new file mode 100644 index 0000000000..da15df81e2 --- /dev/null +++ b/includes/definitions/cnpilotr.yaml @@ -0,0 +1,12 @@ +os: cnpilotr +text: Cambium cnPilot Router +type: network +icon: cambium +mib_dir: cambium\cnpilotr +over: + - { graph: device_bits, text: 'Device Traffic' } +group: cambium +discovery: + - + sysDescr_regex: + - '/(cnPilot R[0-9][0-9][0-9])/i' \ No newline at end of file diff --git a/includes/polling/os/cnpilote.inc.php b/includes/polling/os/cnpilote.inc.php new file mode 100644 index 0000000000..8f788eda83 --- /dev/null +++ b/includes/polling/os/cnpilote.inc.php @@ -0,0 +1,17 @@ +