diff --git a/LibreNMS/Device/WirelessSensor.php b/LibreNMS/Device/WirelessSensor.php index 0b71249c51..b2d67c9f6c 100644 --- a/LibreNMS/Device/WirelessSensor.php +++ b/LibreNMS/Device/WirelessSensor.php @@ -127,6 +127,12 @@ class WirelessSensor extends Sensor // Add new types here // FIXME I'm really bad with icons, someone please help! static $types = array( + 'ap-count' => array( + 'short' => 'APs', + 'long' => 'AP Count', + 'unit' => '', + 'icon' => 'wifi', + ), 'clients' => array( 'short' => 'Clients', 'long' => 'Client Count', diff --git a/LibreNMS/Interfaces/Discovery/Sensors/WirelessApCountDiscovery.php b/LibreNMS/Interfaces/Discovery/Sensors/WirelessApCountDiscovery.php new file mode 100644 index 0000000000..2e8209b425 --- /dev/null +++ b/LibreNMS/Interfaces/Discovery/Sensors/WirelessApCountDiscovery.php @@ -0,0 +1,37 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2017 Tony Murray + * @author Tony Murray + */ + +namespace LibreNMS\Interfaces\Discovery\Sensors; + +interface WirelessApCountDiscovery +{ + /** + * Discover wireless capacity. This is a percent. Type is capacity. + * Returns an array of LibreNMS\Device\Sensor objects that have been discovered + * + * @return array Sensors + */ + public function discoverWirelessApCount(); +} diff --git a/LibreNMS/Interfaces/Polling/Sensors/WirelessApCountPolling.php b/LibreNMS/Interfaces/Polling/Sensors/WirelessApCountPolling.php new file mode 100644 index 0000000000..774c44fa53 --- /dev/null +++ b/LibreNMS/Interfaces/Polling/Sensors/WirelessApCountPolling.php @@ -0,0 +1,38 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2017 Tony Murray + * @author Tony Murray + */ + +namespace LibreNMS\Interfaces\Polling\Sensors; + +interface WirelessApCountPolling +{ + /** + * Poll wireless AP count + * The returned array should be sensor_id => value pairs + * + * @param array $sensors Array of sensors needed to be polled + * @return array of polled data + */ + public function pollWirelessApCount(array $sensors); +} diff --git a/LibreNMS/OS/Ciscowlc.php b/LibreNMS/OS/Ciscowlc.php index 71a873832e..9f6c065af7 100644 --- a/LibreNMS/OS/Ciscowlc.php +++ b/LibreNMS/OS/Ciscowlc.php @@ -26,10 +26,11 @@ namespace LibreNMS\OS; use LibreNMS\Device\WirelessSensor; +use LibreNMS\Interfaces\Discovery\Sensors\WirelessApCountDiscovery; use LibreNMS\Interfaces\Discovery\Sensors\WirelessClientsDiscovery; use LibreNMS\OS; -class Ciscowlc extends OS implements WirelessClientsDiscovery +class Ciscowlc extends OS implements WirelessClientsDiscovery, WirelessApCountDiscovery { /** * Discover wireless client counts. Type is clients. @@ -75,4 +76,41 @@ class Ciscowlc extends OS implements WirelessClientsDiscovery return $sensors; } + + /** + * Discover wireless capacity. This is a percent. Type is capacity. + * Returns an array of LibreNMS\Device\Sensor objects that have been discovered + * + * @return array Sensors + */ + public function discoverWirelessApCount() + { + $oids = array( + 'CISCO-LWAPP-SYS-MIB::clsSysApConnectCount.0', + 'AIRESPACE-SWITCHING-MIB::agentInventoryMaxNumberOfAPsSupported.0', + ); + $data = snmp_get_multi($this->getDevice(), $oids); + + if (isset($data[0]['clsSysApConnectCount'])) { + return array( + new WirelessSensor( + 'ap-count', + $this->getDeviceId(), + '.1.3.6.1.4.1.9.9.618.1.8.4.0', + 'ciscowlc', + 0, + 'Connected APs', + $data[0]['clsSysApConnectCount'], + 1, + 1, + 'sum', + null, + $data[0]['agentInventoryMaxNumberOfAPsSupported'], + 0 + ), + ); + } + + return array(); + } } diff --git a/html/includes/graphs/device/wireless_ap-count.inc.php b/html/includes/graphs/device/wireless_ap-count.inc.php new file mode 100644 index 0000000000..61107a5634 --- /dev/null +++ b/html/includes/graphs/device/wireless_ap-count.inc.php @@ -0,0 +1,9 @@ +