diff options
author | Niklas Yann Wettengel <niyawe@niyawe.de> | 2017-12-15 22:46:27 +0100 |
---|---|---|
committer | Niklas Yann Wettengel <niyawe@niyawe.de> | 2017-12-15 22:46:27 +0100 |
commit | d2270e2e5045fa1999e8712394e06c1ff27e6ab3 (patch) | |
tree | 8ce5c47f2654f244fed5e7e03f3d4d265a1978a9 | |
parent | ca323efbf41f894bd4fb137e191c964e4a781fc5 (diff) |
ffmyk influx minimize memory usage
-rw-r--r-- | roles/install_monitoring/templates/ffmyk-influx/dhcp.php.j2 | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/roles/install_monitoring/templates/ffmyk-influx/dhcp.php.j2 b/roles/install_monitoring/templates/ffmyk-influx/dhcp.php.j2 index 66371ef..7b81328 100644 --- a/roles/install_monitoring/templates/ffmyk-influx/dhcp.php.j2 +++ b/roles/install_monitoring/templates/ffmyk-influx/dhcp.php.j2 @@ -2,9 +2,9 @@ require('func.php'); - $data = file_get_contents('/var/lib/dhcp/dhcpd.leases'); + $data = shell_exec("grep -e 'lease [[:digit:]\.]\+ {' -e '\s\+ends' /var/lib/dhcp/dhcpd.leases"); - preg_match_all('/lease ([\d\.]+) \{[^\}]+ends \d+ (\d{4}\/\d{2}\/\d{2} \d+:\d{2}:\d{2});[^\}]+}/s', $data, $match); + preg_match_all('/lease ([\d\.]+) \{\n\s+ends \d+ (\d{4}\/\d{2}\/\d{2} \d+:\d{2}:\d{2});/s', $data, $match); unset($data, $match[0]); |