diff --git a/src/freedombone-installer b/src/freedombone-installer index 25f7712b8a6901b34c4b05175f1b2b5dbd655fd8..850743546632177d4488b554f478eeb392cf28f8 100755 --- a/src/freedombone-installer +++ b/src/freedombone-installer @@ -1400,6 +1400,9 @@ function update_system_monitor { total_memory=$(free -m | grep "Mem:" | awk -F ' ' '{print $2}') used_memory_percent=$((used_memory * 100 / total_memory)) + cpu_temp=$(cat /sys/class/thermal/thermal_zone*/temp | head -n 1) + cpu_temperature=$((cpu_temp / 1000)) + local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local webadmin_install_dir="/var/www/${local_hostname}/htdocs/admin" if [ -f "$webadmin_install_dir/system_monitor_template.html" ]; then @@ -1411,6 +1414,8 @@ function update_system_monitor { sed -i "s|<div name=\"memory\" class=\"w3-container.*|<div name=\"memory\" class=\"w3-container w3-blue w3-round-xlarge\" style=\"width:${used_memory_percent}%\">${used_memory_percent}%</div>|g" "$webadmin_install_dir/system_monitor.html" + sed -i "s|<div name=\"cputemp\" class=\"w3-container.*|<div name=\"cputemp\" class=\"w3-container w3-blue w3-round-xlarge\" style=\"width:${cpu_temperature}%\">${cpu_temperature}°C</div>|g" "$webadmin_install_dir/system_monitor.html" + chown www-data:www-data "$webadmin_install_dir/system_monitor.html" fi fi diff --git a/src/freedombone-utils-webadmin b/src/freedombone-utils-webadmin index 7159dc335aa73bad100dd588c1e70c106cfc5792..7b40cd85f67f73137cf71751aba1c52c28e8e884 100755 --- a/src/freedombone-utils-webadmin +++ b/src/freedombone-utils-webadmin @@ -705,6 +705,9 @@ function webadmin_update_system_monitor { total_memory=$(free -m | grep "Mem:" | awk -F ' ' '{print $2}') used_memory_percent=$((used_memory * 100 / total_memory)) + cpu_temp=$(cat /sys/class/thermal/thermal_zone*/temp | head -n 1) + cpu_temperature=$((cpu_temp / 1000)) + local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local webadmin_install_dir="/var/www/${local_hostname}/htdocs/admin" if [ -f "$webadmin_install_dir/system_monitor_template.html" ]; then @@ -716,6 +719,8 @@ function webadmin_update_system_monitor { sed -i "s|<div name=\"memory\" class=\"w3-container.*|<div name=\"memory\" class=\"w3-container w3-blue w3-round-xlarge\" style=\"width:${used_memory_percent}%\">${used_memory_percent}%</div>|g" "$webadmin_install_dir/system_monitor.html" + sed -i "s|<div name=\"cputemp\" class=\"w3-container.*|<div name=\"cputemp\" class=\"w3-container w3-blue w3-round-xlarge\" style=\"width:${cpu_temperature}%\">${cpu_temperature}°C</div>|g" "$webadmin_install_dir/system_monitor.html" + chown www-data:www-data "$webadmin_install_dir/system_monitor.html" fi } diff --git a/webadmin/EN/system_monitor_template.html b/webadmin/EN/system_monitor_template.html index c5a5d31349337713348ff8ea10b150a0df70323c..6f8b8fe35f3b596428a4d8d2e6eb034c70d4a4dd 100644 --- a/webadmin/EN/system_monitor_template.html +++ b/webadmin/EN/system_monitor_template.html @@ -91,6 +91,11 @@ <div name="memory" class="w3-container w3-blue w3-round-xlarge" style="width:80%">80%</div> </div> + <p class="titletext">CPU temperature</p> + <div class="w3-light-grey w3-round-xlarge"> + <div name="cputemp" class="w3-container w3-blue w3-round-xlarge" style="width:40%">40°C</div> + </div> + <br><br> <form action="systemmonitor.php" method="post">