aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorM.Gergő2020-05-26 13:56:06 +0200
committerM.Gergő2020-05-26 13:56:06 +0200
commit982295c92484494daff29b5eeb659e1592b61571 (patch)
tree2e2690d7b12c0f1e9d3490af130e11ea51c0bbf6
parent35102d015abc46b0ccd63dc0b442280cb4f3faea (diff)
downloadmunin-unifi-982295c92484494daff29b5eeb659e1592b61571.tar.gz
munin-unifi-982295c92484494daff29b5eeb659e1592b61571.zip
Readme update
-rw-r--r--README.md34
-rw-r--r--ubnt_unifi.php7
2 files changed, 24 insertions, 17 deletions
diff --git a/README.md b/README.md
index 8d40d7a..ca25aa7 100644
--- a/README.md
+++ b/README.md
@@ -7,16 +7,16 @@
* PHP SNMP module
* PHP JSON module
* Debian(9+): `sudo apt-get install php php-cgi php-snmp php-json`
+ * Installed munin instance `(sudo apt-get install munin)`
* It can use php child-processes to get responses faster.
-* If snmp oids are different on your product, you can use
- `snmpwalk -v2c -c public ap01.network.lan 'iso.3.6.1.4.1.41112'` command to clarify them.
-* Official UBNT Unifi SNMP MIBs are available here: [Forum](https://community.ui.com/questions/MIBs-/a0365341-b14f-441b-9484-fd4be414d281)
-* Tested with: AP-AC-PRO (up to now).
+* Tested with: Ubiquiti Unifi AP-AC-PRO and Debian 9, Ubuntu 18.04
## Usage
-unifi_munin - Munin plugin to monitor UBNT unifi wireless APs
+unifi_munin - Munin plugin to monitor UBNT unifi wireless APs
+(And also makes graphs for all access points, one by one.)
+Summary graphs:
Number of Clients
![munin](http://git.bmrg.hu/images/munin-unifi.git/munin-ssid.png)
@@ -24,7 +24,9 @@ Network Usage
![munin](http://git.bmrg.hu/images/munin-unifi.git/munin-netw.png)
Ap-response time
-![munin](http://git.bmrg.hu/images/munin-unifi.git/munin-ping.png)
+![munin](http://git.bmrg.hu/images/munin-unifi.git/munin-ping.png)
+
+
## Installing on Debian
@@ -53,9 +55,9 @@ Ap-response time
Edit the **/etc/munin/munin.conf** with the following options:
- [unifi.company.com] #Unifi Controller hostname
- address 127.0.0.1 #This plugin uses a wirtual munin node on localhost,
- use_node_name no #but don't need to use the node name.
+ [unifi.company.com] #Unifi Controller hostname/ip.
+ address 127.0.0.1 #Which munin-node runs this plugin? (Default: local node, as virtual),
+ use_node_name no #Always don't need to use the node name. (This plugin makes a virtual node)
timeout 240 #Timeout, while this plugin can be runned by munin. (whole running time).
@@ -63,7 +65,7 @@ Edit the **/etc/munin/plugin-conf.d/munin-node**, and use the following configur
[ubnt_unifi]
timeout - Munin-update timeout for this plugin.
- env.controller - The unifi controller hostname/ip.
+ env.controller - The unifi controller hostname/ip. (Must be same as above!)
env.devices - A "space" separated list of the hostnames or IP addresses of wireless APs.
env.timeout - The maximum timeout in milliseconds for SNMP requests. (must enough to get all data from one AP!).
env.retry - Number of retry after failed/time out SNMP requets.
@@ -88,15 +90,19 @@ For example:
### DEBUG Checklist
* Munin output with: `munin-run ubnt_unifi` command.
-* Munin configuration with: `munin-run ubnt_unifi config` command.
+* Graph configuration with: `munin-run ubnt_unifi config` command.
* Debug information with: `munin-run ubnt_unifi debug` command.
+* Is **[controller_name]**, (in munin.conf) **same** as **env.controller** (in plugin-conf.d/munin-node) ?
+* Query the runner munin node with telnet eg: `telnet localhost 4949` , after connect: `fetch ubnt_unifi`
+* Is `php-json` and `php-snmp` installed?
+* Try `snmpwalk -v2c -c public ap01.network.lan 'iso.3.6.1.4.1.41112'` command on munin server.
+ (May need `>> sudo apt-get install snmp` before, on Debian server.)
+* Is SNMP enabled in Unifi configuration, or on Access Points?
* Is there a direct connection (Routing/SNMP_port: 161) between munin-server and Access Points?
-* Is "php-json" and "php-snmp" installed?
-* Is SNMP enabled in Unifi configuration, or on Access Points?
* Try ping APs from munin server.
----
+-------
### AUTHOR
diff --git a/ubnt_unifi.php b/ubnt_unifi.php
index 880c7df..2358575 100644
--- a/ubnt_unifi.php
+++ b/ubnt_unifi.php
@@ -443,7 +443,7 @@ return $ret;
-/********************* START *******************/
+/******************************** START ********************************/
$hosts = explode(" ", $hosts);
@@ -510,6 +510,7 @@ for($i=0,$j=0; $i<$numhost; $i++){ //Sorting addresses for child-processes
}
+/******************************** Child Processes ********************************/
for ($p=0; $p<$maxproc; $p++){ //Starts child processes to retrieve SNMP data.
@@ -574,7 +575,7 @@ function numchild($child, $n){ //How many child process is alive
return $l;
}
-
+/******************************** Wait for childs ********************************/
while(numchild($child, $maxproc)){ //Receive the raw data segments and wait for child processes
for($p=0; $p<$maxproc; $p++){
@@ -603,11 +604,11 @@ $hostsip = $hostsipr;
//$test = collect_response_time($raw, "ap12.wireless.lan");
//print_r($test);
+/******************************** Print the result ********************************/
if(!is_array($raw) /*|| empty($raw)*/){
die();
}
-
if (isset($argv[1]) and $argv[1] == "config"){ // munin config
print_header(collect_radio_summary($raw,null));