From c774ad90c2ae7f131decfe85b1b8212b7592c86f Mon Sep 17 00:00:00 2001 From: JonatanRek Date: Tue, 28 Apr 2020 15:17:14 +0200 Subject: [PATCH] Server informations --- app/views/Log.php | 23 +++++++++++++++++++++++ app/views/templates/log.phtml | 13 ++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/app/views/Log.php b/app/views/Log.php index 3fd6338..e05bcaa 100644 --- a/app/views/Log.php +++ b/app/views/Log.php @@ -3,6 +3,19 @@ class Log extends Template { + //TODO: to server manager + function getSystemMemInfo() + { + $data = explode("\n", file_get_contents("/proc/meminfo")); + $meminfo = array(); + foreach ($data as $line) { + $data = explode(":", $line); + if (count($data)!=2) continue; + $meminfo[$data[0]] = trim($data[1]); + } + return $meminfo; + } + function __construct() { global $userManager; @@ -31,6 +44,16 @@ class Log extends Template $template->prepare('title', 'Logy'); $template->prepare('logsFiles', $result); $template->prepare('langMng', $langMng); + $template->prepare('CPU', sys_getloadavg()[0]); + $template->prepare('UPTIME', shell_exec('uptime -p')); + $template->prepare('ramFree', $this->getSystemMemInfo()["MemFree"]); + $template->prepare('ramTotal', $this->getSystemMemInfo()["MemTotal"]); + $template->prepare('diskTotal', disk_total_space("/")); + + + + + $template->render(); diff --git a/app/views/templates/log.phtml b/app/views/templates/log.phtml index 97b11b5..d85b016 100644 --- a/app/views/templates/log.phtml +++ b/app/views/templates/log.phtml @@ -22,7 +22,18 @@
- +
+ +
+
+
+
+
+ " max="">
+ +
+ +