diff options
author | Noodlesalat <nudelsalat@clouz.de> | 2017-11-01 21:53:46 +0300 |
---|---|---|
committer | Noodlesalat <nudelsalat@clouz.de> | 2017-11-01 21:55:07 +0300 |
commit | 2a3b31b2dc626ac4eed86f7a2c40e1e6c70c9f6d (patch) | |
tree | a1da670878cb35011b8e8c679d7433f1de506bca /lib/SystemStatistics.php | |
parent | 47f43f8e4a49aa62e1cb38f3b66aa4cf7b84df4f (diff) |
Splitted swap and memory graph into two different graphs
Signed-off-by: Fabian Dreßler <nudelsalat@clouz.de>
Diffstat (limited to 'lib/SystemStatistics.php')
-rw-r--r-- | lib/SystemStatistics.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/SystemStatistics.php b/lib/SystemStatistics.php index 28966de..d139831 100644 --- a/lib/SystemStatistics.php +++ b/lib/SystemStatistics.php @@ -58,7 +58,9 @@ class SystemStatistics { 'freespace' => $this->view->free_space(), 'cpuload' => sys_getloadavg(), 'mem_total' => $memoryUsage['mem_total'], - 'mem_free' => $memoryUsage['mem_free'] + 'mem_free' => $memoryUsage['mem_free'], + 'swap_total' => $memoryUsage['swap_total'], + 'swap_free' => $memoryUsage['swap_free'] ]; } @@ -75,7 +77,7 @@ class SystemStatistics { } // check if determining memoryUsage failed if ($memoryUsage === false) { - return ['mem_free' => 'N/A', 'mem_total' => 'N/A']; + return ['mem_free' => 'N/A', 'mem_total' => 'N/A', 'swap_free' => 'N/A', 'swap_total' => 'N/A']; } $array = explode(PHP_EOL, $memoryUsage); // the last value is a empty string after explode, skip it @@ -94,8 +96,10 @@ class SystemStatistics { } return [ - 'mem_free' => (int)$available + (int)$data['SwapFree'], - 'mem_total' => (int)$data['MemTotal'] + (int)$data['SwapTotal'] + 'mem_free' => (int)$available, + 'mem_total' => (int)$data['MemTotal'], + 'swap_free' => (int)$data['SwapFree'], + 'swap_total' => (int)$data['SwapTotal'] ]; } |