1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2023-10-10 13:37:24 +02:00
raspap-webgui/includes/sysstats.php

50 lines
983 B
PHP
Raw Normal View History

2020-02-02 12:55:10 +01:00
<?php
include_once('app/lib/system.php');
$system = new System();
$hostname = $system->hostname();
$uptime = $system->uptime();
$cores = $system->processorCount();
// mem used
$memused = $system->usedMemory();
$memused_status = "primary";
if ($memused > 90) {
2020-02-02 12:57:31 +01:00
$memused_status = "danger";
2020-02-02 12:55:10 +01:00
} elseif ($memused > 75) {
2020-02-02 12:57:31 +01:00
$memused_status = "warning";
2020-02-02 12:55:10 +01:00
} elseif ($memused > 0) {
2020-02-02 12:57:31 +01:00
$memused_status = "success";
2020-02-02 12:55:10 +01:00
}
// cpu load
$cpuload = $system->systemLoadPercentage();
if ($cpuload > 90) {
2020-02-02 12:57:31 +01:00
$cpuload_status = "danger";
2020-02-02 12:55:10 +01:00
} elseif ($cpuload > 75) {
2020-02-02 12:57:31 +01:00
$cpuload_status = "warning";
2020-02-02 12:55:10 +01:00
} elseif ($cpuload > 0) {
2020-02-02 12:57:31 +01:00
$cpuload_status = "success";
2020-02-02 12:55:10 +01:00
}
// cpu temp
$cputemp = $system->systemTemperature();
if ($cputemp > 70) {
2020-02-02 12:57:31 +01:00
$cputemp_status = "danger";
2020-02-02 12:55:10 +01:00
} elseif ($cputemp > 50) {
2020-02-02 12:57:31 +01:00
$cputemp_status = "warning";
2020-02-02 12:55:10 +01:00
} else {
2020-02-02 12:57:31 +01:00
$cputemp_status = "success";
2020-02-02 12:55:10 +01:00
}
// hostapd status
$hostapd = $system->hostapdStatus();
if ($hostapd) {
2020-02-02 12:57:31 +01:00
$hostapd_status = "success";
2020-02-02 12:55:10 +01:00
} else {
2020-02-02 12:57:31 +01:00
$hostapd_status = "danger";
2020-02-02 12:55:10 +01:00
}