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

52 lines
1.1 KiB
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 13:40:24 +01:00
$memused_status = "danger";
2020-02-02 12:55:10 +01:00
} elseif ($memused > 75) {
2020-02-02 13:40:24 +01:00
$memused_status = "warning";
2020-02-02 12:55:10 +01:00
} elseif ($memused > 0) {
2020-02-02 13:40:24 +01:00
$memused_status = "success";
2020-02-02 12:55:10 +01:00
}
// cpu load
$cpuload = $system->systemLoadPercentage();
if ($cpuload > 90) {
2020-02-02 13:40:24 +01:00
$cpuload_status = "danger";
2020-02-02 12:55:10 +01:00
} elseif ($cpuload > 75) {
2020-02-02 13:40:24 +01:00
$cpuload_status = "warning";
2020-02-02 12:55:10 +01:00
} elseif ($cpuload > 0) {
2020-02-02 13:40:24 +01:00
$cpuload_status = "success";
2020-02-02 12:55:10 +01:00
}
// cpu temp
$cputemp = $system->systemTemperature();
if ($cputemp > 70) {
2020-02-02 13:40:24 +01:00
$cputemp_status = "danger";
2020-02-02 12:55:10 +01:00
} elseif ($cputemp > 50) {
2020-02-02 13:40:24 +01:00
$cputemp_status = "warning";
2020-02-02 12:55:10 +01:00
} else {
2020-02-02 13:40:24 +01:00
$cputemp_status = "success";
2020-02-02 12:55:10 +01:00
}
// hostapd status
$hostapd = $system->hostapdStatus();
2020-02-02 13:40:24 +01:00
if ($hostapd[0] ==1) {
$hostapd_status = "active";
$hostapd_led = "service-status-up";
2020-02-02 12:55:10 +01:00
} else {
2020-02-02 13:40:24 +01:00
$hostapd_status = "inactive";
$hostapd_led = "service-status-down";
2020-02-02 12:55:10 +01:00
}