Server informations

This commit is contained in:
JonatanRek
2020-04-28 15:17:14 +02:00
parent e0bbc09389
commit c774ad90c2
2 changed files with 35 additions and 1 deletions

View File

@@ -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();