aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorM.Gergő2020-05-25 15:03:28 +0200
committerM.Gergő2020-05-25 15:03:28 +0200
commitd33ee24ff6f5face09765539376a4e6a2728b478 (patch)
tree8a8ba016fd7e32c9b89d14307c5d1880eccf56d4
parentaf737457415f333159b9f726b14554ac5e50e02c (diff)
downloadmunin-unifi-d33ee24ff6f5face09765539376a4e6a2728b478.tar.gz
munin-unifi-d33ee24ff6f5face09765539376a4e6a2728b478.zip
More debug info
-rw-r--r--README.md4
-rw-r--r--ubnt_unifi.php34
2 files changed, 30 insertions, 8 deletions
diff --git a/README.md b/README.md
index 6dfca1b..565441f 100644
--- a/README.md
+++ b/README.md
@@ -3,6 +3,10 @@
* Requires:
* Enabled SNMP on AP's.
* Network access from munin-server to AP's network.
+ * PHP 7.0 or above
+ * PHP SNMP module
+ * PHP JSON module
+ * Debian(9+): `sudo apt-get install php php-cgi php-snmp php-json`
* 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.
diff --git a/ubnt_unifi.php b/ubnt_unifi.php
index 097b15c..00edda5 100644
--- a/ubnt_unifi.php
+++ b/ubnt_unifi.php
@@ -577,12 +577,13 @@ $hosts = $hostsr;
//$test = collect_response_time($raw, "ap12.wireless.lan");
//print_r($test);
-if(!is_array($raw)){
- die();
-}
+
if (isset($argv[1]) and $argv[1] == "config"){ // munin config
+ if(!is_array($raw) || empty($raw) ){
+ die();
+ }
print_header(collect_radio_summary($raw,null));
foreach($hosts as $key => $val){
print_header(collect_radio_summary($raw,$val));
@@ -604,20 +605,37 @@ if (isset($argv[1]) and $argv[1] == "config"){ // munin config
echo "\tRetry: ".$retry."\n";
echo "\tMaxproc: ".$maxproc."\n";
echo "\tDevices_network: ".$devnetw."\n";
- echo "\tDevice_hosts: \n";
- print_r($hosts);
+ echo "\tDevice_hosts: \n";
+ foreach($hosts as $dgk => $dgv){
+ echo "\t\tIP: ".gethostbyname($dgv)."\tHost: ".$dgv."\n";
+ }
echo "\nInternal: \n";
- echo "\tShared_mem_key: ".$shm_key."\n";
+ echo "\tShared_key: ".$shm_key."\n";
+ echo "\tShared_mem_key".$shm."\n";
+ echo "\tSemaphore_key".$sf."\n";
+ echo "\tFunction_exist(ftok): ".function_exists("ftok");
+ echo "\tFunction_exist(shmop_open): ".function_exists("shmop_open");
+ echo "\tFunction_exist(sem_get): ".function_exists("sem_get");
+ echo "\tFunction_exist(pcntl_fork): ".function_exists("pcntl_fork");
+ echo "\tFunction_exist(pcntl_waitpid): ".function_exists("pcntl_waitpid");
+ echo "\tFunction_exist(json_encode): ".function_exists("json_encode");
echo "\nRAW\n";
print_r($raw);
- echo "\nController:\n";
+ echo "\nCollected infos on Controller:\n";
print_r(collect_radio_summary($raw,null));
print_r(collect_netw_summary($raw,null));
- print_r(collect_response_time($raw,null));
+ print_r(collect_response_time($raw,null));
+
+ echo "\n Print test on Controller: \n";
+ print_header(collect_radio_summary($raw,null));
+ print_data(collect_radio_summary($raw,null));
} else { // munin data
+ if(!is_array($raw) || empty($raw) ){
+ die();
+ }
print_data(collect_radio_summary($raw,null));
foreach($hosts as $key => $val){
print_data(collect_radio_summary($raw,$val));