From 10ad85374f6c2a0d55ffa5b4a02049affecf0cf6 Mon Sep 17 00:00:00 2001 From: Justin Settle Date: Mon, 17 Oct 2016 11:02:43 -0400 Subject: [PATCH] Add mib-based polling of Unifi Wifi Capacity --- .../device/ubnt_unifi_RadioCu_0.inc.php | 35 ++++++++++ .../device/ubnt_unifi_RadioCu_1.inc.php | 35 ++++++++++ includes/definitions.inc.php | 9 +++ includes/polling/mib/ubnt-unifi-mib.inc.php | 69 +++++++++++++++++++ includes/polling/wifi.inc.php | 1 + 5 files changed, 149 insertions(+) create mode 100644 html/includes/graphs/device/ubnt_unifi_RadioCu_0.inc.php create mode 100644 html/includes/graphs/device/ubnt_unifi_RadioCu_1.inc.php create mode 100644 includes/polling/mib/ubnt-unifi-mib.inc.php diff --git a/html/includes/graphs/device/ubnt_unifi_RadioCu_0.inc.php b/html/includes/graphs/device/ubnt_unifi_RadioCu_0.inc.php new file mode 100644 index 0000000000..9632cde8c7 --- /dev/null +++ b/html/includes/graphs/device/ubnt_unifi_RadioCu_0.inc.php @@ -0,0 +1,35 @@ + 'Radio0OtherBss', + 'filename' => $rrd_filename, + 'descr' => 'Radio0 Others', + ), + array( + 'ds' => 'Radio0CuSelfRx', + 'filename' => $rrd_filename, + 'descr' => 'Radio0 RX', + ), + array( + 'ds' => 'Radio0CuSelfTx', + 'filename' => $rrd_filename, + 'descr' => 'Radio0 TX', + ), + ); +} else { + echo "file missing: $rrd_filename"; +} + +require 'includes/graphs/generic_multi.inc.php'; diff --git a/html/includes/graphs/device/ubnt_unifi_RadioCu_1.inc.php b/html/includes/graphs/device/ubnt_unifi_RadioCu_1.inc.php new file mode 100644 index 0000000000..81fa57ed8c --- /dev/null +++ b/html/includes/graphs/device/ubnt_unifi_RadioCu_1.inc.php @@ -0,0 +1,35 @@ + 'Radio1OtherBss', + 'filename' => $rrd_filename, + 'descr' => 'Radio1 Others', + ), + array( + 'ds' => 'Radio1CuSelfRx', + 'filename' => $rrd_filename, + 'descr' => 'Radio1 RX', + ), + array( + 'ds' => 'Radio1CuSelfTx', + 'filename' => $rrd_filename, + 'descr' => 'Radio1 TX', + ), + ); +} else { + echo "file missing: $rrd_filename"; +} + +require 'includes/graphs/generic_multi.inc.php'; diff --git a/includes/definitions.inc.php b/includes/definitions.inc.php index 8bb35d342b..81d96a9245 100644 --- a/includes/definitions.inc.php +++ b/includes/definitions.inc.php @@ -2288,6 +2288,15 @@ $config['graph_types']['device']['ubnt_airfiber_RFTotPktsRx']['section'] = 'wire $config['graph_types']['device']['ubnt_airfiber_RFTotPktsRx']['order'] = '7'; $config['graph_types']['device']['ubnt_airfiber_RFTotPktsRx']['descr'] = 'RF Total Packets Rx'; +// Unifi Support +$config['graph_types']['device']['ubnt_unifi_RadioCu_0']['section'] = 'wireless'; +$config['graph_types']['device']['ubnt_unifi_RadioCu_0']['order'] = '0'; +$config['graph_types']['device']['ubnt_unifi_RadioCu_0']['descr'] = 'Radio0 Capacity Used'; + +$config['graph_types']['device']['ubnt_unifi_RadioCu_1']['section'] = 'wireless'; +$config['graph_types']['device']['ubnt_unifi_RadioCu_1']['order'] = '1'; +$config['graph_types']['device']['ubnt_unifi_RadioCu_1']['descr'] = 'Radio1 Capacity Used'; + // Siklu support $config['graph_types']['device']['siklu_rfAverageRssi']['section'] = 'wireless'; $config['graph_types']['device']['siklu_rfAverageRssi']['order'] = '0'; diff --git a/includes/polling/mib/ubnt-unifi-mib.inc.php b/includes/polling/mib/ubnt-unifi-mib.inc.php new file mode 100644 index 0000000000..aa86e06f50 --- /dev/null +++ b/includes/polling/mib/ubnt-unifi-mib.inc.php @@ -0,0 +1,69 @@ + array( + '', + 'Radio0CuTotal', + 'Radio0 Channel Utilized', + 'GAUGE', + ), + 'unifiRadioCuTotal.1' => array( + '', + 'Radio1CuTotal', + 'Radio1 Channel Utilized', + 'GAUGE', + ), + 'unifiRadioCuSelfRx.0' => array( + '', + 'Radio0CuSelfRx', + 'Radio0 Channel Utilized Rx', + 'GAUGE', + ), + 'unifiRadioCuSelfRx.1' => array( + '', + 'Radio1CuSelfRx', + 'Radio1 Channel Utilized Rx', + 'GAUGE', + ), + 'unifiRadioCuSelfTx.0' => array( + '', + 'Radio0CuSelfTx', + 'Radio0 Channel Utilized Tx', + 'GAUGE', + ), + 'unifiRadioCuSelfTx.1' => array( + '', + 'Radio1CuSelfTx', + 'Radio1 Channel Utilized Tx', + 'GAUGE', + ), + 'unifiRadioOtherBss.0' => array( + '', + 'Radio0OtherBss', + 'Radio0 Channel Utilized by Others', + 'GAUGE', + ), + 'unifiRadioOtherBss.1' => array( + '', + 'Radio1OtherBss', + 'Radio1 Channel Utilized by Others', + 'GAUGE', + ), +); + + +$mib_graphs = array( + 'ubnt_unifi_RadioCu_0', + 'ubnt_unifi_RadioCu_1', +); + +unset($graph, $oids, $oid); + +poll_mib_def($device, 'UBNT-UniFi-MIB:UBNT', 'ubiquiti', $mib_oids, $mib_graphs, $graphs); +// EOF diff --git a/includes/polling/wifi.inc.php b/includes/polling/wifi.inc.php index 1444915828..99685f1599 100644 --- a/includes/polling/wifi.inc.php +++ b/includes/polling/wifi.inc.php @@ -77,6 +77,7 @@ if ($device['type'] == 'network' || $device['type'] == 'firewall' || $device['ty } echo (($wificlients1 + 0).' clients on Radio0, '.($wificlients2 + 0)." clients on Radio1\n"); + include 'includes/polling/mib/ubnt-unifi-mib.inc.php'; } if (isset($wificlients1) && $wificlients1 != '') {