diff options
author | M.Gergő | 2019-02-05 22:18:03 +0100 |
---|---|---|
committer | M.Gergő | 2019-02-05 22:18:03 +0100 |
commit | 54db99c38b065ef81c07b3fd3ebd8436bc1a8449 (patch) | |
tree | a26e5647de21191a91ee4d75b9d3f245667a1b23 | |
parent | 41526163a28cb5c9960020a7392b21871650e2da (diff) | |
download | munin-unifi-54db99c38b065ef81c07b3fd3ebd8436bc1a8449.tar.gz munin-unifi-54db99c38b065ef81c07b3fd3ebd8436bc1a8449.zip |
better error handling
-rw-r--r-- | ubnt_unifi.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ubnt_unifi.php b/ubnt_unifi.php index e53d461..648a4c0 100644 --- a/ubnt_unifi.php +++ b/ubnt_unifi.php @@ -44,6 +44,10 @@ function print_header($inp){ // prints Munin-config data from processed data arr function print_data($inp) { + + if(!array_key_exists('data', $inp) or !array_key_exists('g_multi', $inp)){ + return; + } $pf = "multigraph unifi_".$inp['g_multi']."\n"; foreach($inp['data'] as $key => $val){ @@ -77,6 +81,10 @@ function count_wl_networks($inp){ //Count wireless networks from interfade data function collect_radio_summary($inp,$host){ global $controller, $replace_chars; $ret = array(); + if(!array_key_exists($host, $inp)){ + return $ret; + } + if(isset($host) and $host !== null and $host != "" ){ $ret['g_multi'] = "radio_".str_replace( array(".", ":"), "_" ,$controller).".".str_replace( array(".", ":"), "_" ,$host); $ret['g_controller'] = $controller; @@ -177,6 +185,9 @@ return $ret; function collect_netw_summary($inp,$host){ //network information global $controller, $replace_chars; $ret = array(); + if(!array_key_exists($host, $inp)){ + return $ret; + } if(isset($host) and $host !== null and $host != "" ){ // When showing the Ap's summary. $temp = $inp; |