Dashboard: skip empty entries in graph

This commit is contained in:
bergware
2023-12-15 10:13:44 +01:00
parent 7dfaf43d7c
commit da7fa2b830

View File

@@ -63,8 +63,10 @@ while (true) {
$bytes = $meminfo = $sysinfo = [];
$hooks = array_filter(glob("/usr/local/emhttp/plugins/*/system/*",GLOB_NOSORT),function($file){return is_executable($file);});
foreach ($hooks as $hook) {
$data = @intval(exec(escapeshellarg($hook)));
if (!$data) continue;
$names[] = _(basename($hook)); // name of element (with translation)
$bytes[] = @intval(exec(escapeshellarg($hook))); // value in bytes of element (error -> 0)
$bytes[] = $data; // value in bytes of element (error -> 0)
}
$services = $used-array_sum($bytes);
$meminfo[] = round(100*$used/$total)."%";