diff --git a/pfsense_zbx.php b/pfsense_zbx.php index 5975f50..0a13f7e 100644 --- a/pfsense_zbx.php +++ b/pfsense_zbx.php @@ -155,7 +155,7 @@ function pfz_interface_speedtest_value($ifname, $value){ $filename = "/tmp/speedtest-$ifname"; if (file_exists($filename)) { - $speedtest_data = json_decode(file_get_contents($filename), true); + $speedtest_data = json_decode(file_get_contents($filename), true) ?? []; if (array_key_exists($value, $speedtest_data)) { if ($subvalue == false) @@ -859,6 +859,13 @@ function pfz_dhcp_get($valuekey) { $leases_count = count($leases_content); @exec("/usr/sbin/arp -an", $rawdata); + $leases = []; + $pools = []; + + $i = 0; + $l = 0; + $p = 0; + foreach ($leases_content as $lease) { /* split the line by space */ $data = explode(" ", $lease); diff --git a/pfsense_zbx_rc.php b/pfsense_zbx_rc.php index 74dda34..9e6d246 100644 --- a/pfsense_zbx_rc.php +++ b/pfsense_zbx_rc.php @@ -671,7 +671,7 @@ class SpeedTest return Util::result(""); } - $speed_test_data = json_decode(file_get_contents($filename), true); + $speed_test_data = json_decode(file_get_contents($filename), true) ?? []; if (!array_key_exists($value, $speed_test_data)) { return Util::result(""); }