From 9970343fe5c8226f25234addc6b80836c092fe1f Mon Sep 17 00:00:00 2001 From: ShevAbam Date: Tue, 7 Jul 2015 15:57:41 +0200 Subject: General : cleaning and optimizing CSS General : responsive design General : reload button now spins when you reload block General : update jQuery plugin Knob to 1.2.11 General : optimizing security (config file esm.config.json is now in the conf/ folder with an htaccess) CPU : retrieves correctly CPU frequency for Raspberry Pi CPU : add CPU temperature (+ option to enable/disable) System : little correction for getting distro name Swap : fix if swap is disabled Services status : adds protocol TCP or UDP for checking service status Services status : new option to hide port number (see show_port in services section) --- libs/cpu.php | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'libs/cpu.php') diff --git a/libs/cpu.php b/libs/cpu.php index 73a5409..9665c87 100644 --- a/libs/cpu.php +++ b/libs/cpu.php @@ -1,5 +1,6 @@ get('cpu:enable_temperature')) +{ + if (exec('/usr/bin/sensors | grep -E "^(CPU Temp|Core 0)" | cut -d \'+\' -f2 | cut -d \'.\' -f1', $t)) + { + if (isset($t[0])) + $temp = $t[0].' °C'; + } + else + { + if (exec('cat /sys/class/thermal/thermal_zone0/temp', $t)) + { + $temp = round($t[0] / 1000).' °C'; + } + } +} + $datas = array( 'model' => $model, @@ -57,6 +85,7 @@ $datas = array( 'frequency' => $frequency, 'cache' => $cache, 'bogomips' => $bogomips, + 'temp' => $temp, ); echo json_encode($datas); \ No newline at end of file -- cgit v1.2.3