aboutsummaryrefslogtreecommitdiffstats
path: root/ubnt_unifi.php
diff options
context:
space:
mode:
Diffstat (limited to 'ubnt_unifi.php')
-rw-r--r--ubnt_unifi.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/ubnt_unifi.php b/ubnt_unifi.php
index 1158190..e53d461 100644
--- a/ubnt_unifi.php
+++ b/ubnt_unifi.php
@@ -441,14 +441,14 @@ for ($p=0; $p<$maxproc; $p++){ //Starts child processes to retrieve SNMP data.
}
$null="";
- for($f=0; $f<(32768 - strlen(json_encode($raw))); $f++)
+ for($f=0; $f<(32768 - strlen(@json_encode($raw))); $f++)
{
$null .= "\0"; //Because the json_decode() error.
}
sem_acquire($sf);
while(ord(shmop_read($shm, 0, 0)) ) {continue;} //waiting for master to pull the data
- shmop_write($shm, json_encode($raw).$null, 0);
+ shmop_write($shm, @json_encode($raw).$null, 0);
sem_release($sf);
}
exit;
@@ -480,7 +480,7 @@ while(numchild($child, $maxproc)){ //Receive the raw data segments and wait for
$ret = shmop_read($shm, 0, 0); //Read from shared memory
if(ord($ret)){
$ret = preg_replace('/[[:cntrl:]]/', '', $ret); // for json_decode
- $raw = array_merge($raw, json_decode($ret, true));
+ $raw = @array_merge($raw, @json_decode($ret, true));
shmop_write($shm,"\0\0\0\0\0", 0);
}
usleep(100); //
@@ -495,6 +495,10 @@ $hosts = $hostsr;
//$test = collect_netw_summary($raw,"ap12.wireless.lan");
//print_r($test);
+if(!is_array($raw)){
+ die();
+}
+
if (isset($argv[1]) and $argv[1] == "config"){ // munin config
print_header(collect_radio_summary($raw,null));