diff --git a/ajax.php b/ajax.php index ede75db..3f96fe1 100644 --- a/ajax.php +++ b/ajax.php @@ -46,4 +46,178 @@ if ($_GET['section'] == "localTx") { } echo '{"data": '.json_encode($lastHeard)."}"; } + +if ($_GET['section'] == "sysinfo") { + $cputemp = NULL; + $cpufreq = NULL; + if (file_exists ("/sys/class/thermal/thermal_zone0/temp")) { + exec("cat /sys/class/thermal/thermal_zone0/temp", $cputemp); + $cputemp = $cputemp[0] / 1000; + } + showLapTime("cputemp"); + if (file_exists ("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq")) { + exec("cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq", $cpufreq); + $cpufreq = $cpufreq[0] / 1000; + } + showLapTime("cpufreq"); + + if (defined("TEMPERATUREALERT") && $cputemp > TEMPERATUREHIGHLEVEL && $cputemp !== NULL) { +?> + +$y) $cpu[$x] = round($y / $total * 100, 1); + $cpuusage = round($cpu['user'] + $cpu['sys'], 2); + showLapTime("cpuusage"); + + $output = shell_exec('grep -c processor /proc/cpuinfo'); + $cpucores = $output; + + $output = shell_exec('cat /proc/uptime'); + $uptime = format_time(substr($output,0,strpos($output," "))); + $idletime = format_time((substr($output,strpos($output," ")))/$cpucores); + showLapTime("idletime"); + + if (defined("SHOWPOWERSTATE")) { + $pinStatus = trim(shell_exec("gpio -g read ".POWERONLINEPIN)); // Pin 18 + } + //returns 0 = low; 1 = high +?> + + + + Power + + CPU-Temperature + + CPU-Frequency + + System-Load + CPU-Usage + Uptime + Idle + + + + + + °C + + MHz + + % + + +
= 30 and $cpuusage < 60) + echo "progress-bar-warning"; + if ($cpuusage >= 60) + echo "progress-bar-danger"; +?>" role="progressbar" aria-valuenow="" aria-valuemin="0" aria-valuemax="100" style="width: %;">%
+ + + + + + + \ No newline at end of file diff --git a/include/sysinfo_ajax.php b/include/sysinfo_ajax.php new file mode 100644 index 0000000..cae62c1 --- /dev/null +++ b/include/sysinfo_ajax.php @@ -0,0 +1,31 @@ +
+ +
System Info
+ +
+ +
+
+
+ + diff --git a/index.php b/index.php index 5106a6a..0382bb6 100644 --- a/index.php +++ b/index.php @@ -68,7 +68,7 @@ checkSetup(); // Here you can feel free to disable info-sections by commenting out with // before include include "include/txinfo.php"; showLapTime("txinfo"); -include "include/sysinfo.php"; +include "include/sysinfo_ajax.php"; showLapTime("sysinfo"); include "include/disk.php"; showLapTime("disk"); diff --git a/version.php b/version.php index 923dea9..812fd84 100644 --- a/version.php +++ b/version.php @@ -1,3 +1,3 @@