2020-02-02 11:55:10 +00:00
|
|
|
<?php
|
|
|
|
|
2021-08-03 14:18:36 +00:00
|
|
|
$system = new \RaspAP\System\Sysinfo;
|
2020-02-02 11:55:10 +00:00
|
|
|
|
|
|
|
$hostname = $system->hostname();
|
|
|
|
$uptime = $system->uptime();
|
|
|
|
$cores = $system->processorCount();
|
|
|
|
|
|
|
|
// mem used
|
|
|
|
$memused = $system->usedMemory();
|
|
|
|
$memused_status = "primary";
|
|
|
|
if ($memused > 90) {
|
2020-02-02 12:40:24 +00:00
|
|
|
$memused_status = "danger";
|
2020-02-03 09:32:16 +00:00
|
|
|
$memused_led = "service-status-down";
|
2020-02-02 11:55:10 +00:00
|
|
|
} elseif ($memused > 75) {
|
2020-02-02 12:40:24 +00:00
|
|
|
$memused_status = "warning";
|
2020-02-03 09:32:16 +00:00
|
|
|
$memused_led = "service-status-warn";
|
2020-02-02 11:55:10 +00:00
|
|
|
} elseif ($memused > 0) {
|
2020-02-02 12:40:24 +00:00
|
|
|
$memused_status = "success";
|
2020-02-03 09:32:16 +00:00
|
|
|
$memused_led = "service-status-up";
|
2020-02-02 11:55:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// cpu load
|
|
|
|
$cpuload = $system->systemLoadPercentage();
|
|
|
|
if ($cpuload > 90) {
|
2020-02-02 12:40:24 +00:00
|
|
|
$cpuload_status = "danger";
|
2020-02-02 11:55:10 +00:00
|
|
|
} elseif ($cpuload > 75) {
|
2020-02-02 12:40:24 +00:00
|
|
|
$cpuload_status = "warning";
|
2020-03-24 18:48:35 +00:00
|
|
|
} elseif ($cpuload >= 0) {
|
2020-02-02 12:40:24 +00:00
|
|
|
$cpuload_status = "success";
|
2020-02-02 11:55:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// cpu temp
|
|
|
|
$cputemp = $system->systemTemperature();
|
|
|
|
if ($cputemp > 70) {
|
2020-02-02 12:40:24 +00:00
|
|
|
$cputemp_status = "danger";
|
2020-02-03 09:32:16 +00:00
|
|
|
$cputemp_led = "service-status-down";
|
2020-02-02 11:55:10 +00:00
|
|
|
} elseif ($cputemp > 50) {
|
2020-02-02 12:40:24 +00:00
|
|
|
$cputemp_status = "warning";
|
2020-02-03 09:32:16 +00:00
|
|
|
$cputemp_led = "service-status-warn";
|
2020-02-02 11:55:10 +00:00
|
|
|
} else {
|
2020-02-02 12:40:24 +00:00
|
|
|
$cputemp_status = "success";
|
2020-02-03 09:32:16 +00:00
|
|
|
$cputemp_led = "service-status-up";
|
2020-02-02 11:55:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// hostapd status
|
|
|
|
$hostapd = $system->hostapdStatus();
|
2020-02-02 12:40:24 +00:00
|
|
|
if ($hostapd[0] ==1) {
|
2023-11-10 21:50:04 +00:00
|
|
|
$hostapd_status = "up";
|
2020-02-02 12:40:24 +00:00
|
|
|
$hostapd_led = "service-status-up";
|
2020-02-02 11:55:10 +00:00
|
|
|
} else {
|
2023-11-10 21:50:04 +00:00
|
|
|
$hostapd_status = "down";
|
2020-02-02 12:40:24 +00:00
|
|
|
$hostapd_led = "service-status-down";
|
2020-02-02 11:55:10 +00:00
|
|
|
}
|
|
|
|
|