mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Merge pull request #479 from Weylin-fr/adding-cpu-temperature
Adding cpu temperature
This commit is contained in:
commit
8ff2167a75
@ -45,5 +45,10 @@ class System {
|
|||||||
public function systemLoadPercentage() {
|
public function systemLoadPercentage() {
|
||||||
return intval(($this->loadAvg1Min() * 100) / $this->processorCount());
|
return intval(($this->loadAvg1Min() * 100) / $this->processorCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function systemTemperature() {
|
||||||
|
$cpuTemp = file_get_contents("/sys/class/thermal/thermal_zone0/temp");
|
||||||
|
return number_format($cpuTemp/1000, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,16 @@ if ($cpuload > 90) {
|
|||||||
$cpuload_status = "success";
|
$cpuload_status = "success";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cpu temp
|
||||||
|
$cputemp = $system->systemTemperature();
|
||||||
|
if ($cputemp > 70) {
|
||||||
|
$cputemp_status = "danger";
|
||||||
|
} elseif ($cputemp > 50) {
|
||||||
|
$cputemp_status = "warning";
|
||||||
|
} else {
|
||||||
|
$cputemp_status = "success";
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
@ -63,12 +73,19 @@ if ($cpuload > 90) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-1"><?php echo _("CPU Load"); ?></div>
|
<div class="mb-1"><?php echo _("CPU Load"); ?></div>
|
||||||
<div class="progress mb-4" style="height: 20px;">
|
<div class="progress mb-2" style="height: 20px;">
|
||||||
<div class="progress-bar bg-<?php echo htmlspecialchars($cpuload_status, ENT_QUOTES); ?>"
|
<div class="progress-bar bg-<?php echo htmlspecialchars($cpuload_status, ENT_QUOTES); ?>"
|
||||||
role="progressbar" aria-valuenow="<?php echo htmlspecialchars($cpuload, ENT_QUOTES); ?>" aria-valuemin="0" aria-valuemax="100"
|
role="progressbar" aria-valuenow="<?php echo htmlspecialchars($cpuload, ENT_QUOTES); ?>" aria-valuemin="0" aria-valuemax="100"
|
||||||
style="width: <?php echo htmlspecialchars($cpuload, ENT_QUOTES); ?>%"><?php echo htmlspecialchars($cpuload, ENT_QUOTES); ?>%
|
style="width: <?php echo htmlspecialchars($cpuload, ENT_QUOTES); ?>%"><?php echo htmlspecialchars($cpuload, ENT_QUOTES); ?>%
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="mb-1"><?php echo _("CPU Temp"); ?></div>
|
||||||
|
<div class="progress mb-4" style="height: 20px;">
|
||||||
|
<div class="progress-bar bg-<?php echo htmlspecialchars($cputemp_status, ENT_QUOTES); ?>"
|
||||||
|
role="progressbar" aria-valuenow="<?php echo htmlspecialchars($cputemp, ENT_QUOTES); ?>" aria-valuemin="0" aria-valuemax="100"
|
||||||
|
style="width: <?php echo htmlspecialchars(($cputemp*1.2), ENT_QUOTES); ?>%"><?php echo htmlspecialchars($cputemp, ENT_QUOTES); ?>°C
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<form action="?page=system_info" method="POST">
|
<form action="?page=system_info" method="POST">
|
||||||
<?php echo CSRFTokenFieldTag() ?>
|
<?php echo CSRFTokenFieldTag() ?>
|
||||||
|
Loading…
Reference in New Issue
Block a user