From d2270e2e5045fa1999e8712394e06c1ff27e6ab3 Mon Sep 17 00:00:00 2001 From: Niklas Yann Wettengel Date: Fri, 15 Dec 2017 22:46:27 +0100 Subject: ffmyk influx minimize memory usage --- roles/install_monitoring/templates/ffmyk-influx/dhcp.php.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'roles/install_monitoring/templates') 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]); -- cgit v1.2.3-54-g00ecf