diff options
Diffstat (limited to 'admin/api/serverTemp.php')
-rw-r--r-- | admin/api/serverTemp.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/admin/api/serverTemp.php b/admin/api/serverTemp.php new file mode 100644 index 0000000..19e383a --- /dev/null +++ b/admin/api/serverTemp.php @@ -0,0 +1,20 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php"; + +echo("Server running at <b>"); +exec("sensors -j", $out); +$outp = implode("\n", $out); +$outd = json_decode($outp, true); + +echo(round($outd["cpu_thermal-virtual-0"]["temp1"]["temp1_input"], 1)); + +?>°C</b>, <?php + +if ($outd["cpu_thermal-virtual-0"]["temp1"]["temp1_input"] > 90) { + echo("completely overheating!"); +} else if ($outd["cpu_thermal-virtual-0"]["temp1"]["temp1_input"] > 60) { + echo("starting to throttle!"); +} else { + echo("under normal temperatures"); +}
\ No newline at end of file |