Code: Alles auswählen
CPU_Load CCU 24.07.2021 15:50:23
55.91
Moderatoren: jmaus, Co-Administratoren
Code: Alles auswählen
CPU_Load CCU 24.07.2021 15:50:23
55.91
Code: Alles auswählen
enrico@tinkerboard:~$ cat /proc/loadavg | cut -d' ' -f-3 | tr -d '\n'
0.24 0.23 0.24enrico@tinkerboard:~$
enrico@tinkerboard:~$
Code: Alles auswählen
enrico@tinkerboard:~$ awk '{s=int($1);d=int(s/86400);h=int(s % 86400/3600);m=int(s % 3600 / 60); printf \"%d days, %02d:%02d\", d, h, m}' /proc/uptime
awk: 1: unexpected character '\'
awk: line 1: runaway string constant "%d days, % ...
enrico@tinkerboard:~$
Code: Alles auswählen
string temp;
system.Exec("cat /sys/class/thermal/thermal_zone0/temp | sed 's/.\{3\}$/.&/'", &temp);
if(temp != "") {
dom.GetObject(ID_SYSTEM_VARIABLES).Get("CCU_Temperatur").State(temp);
}
string temp2;
system.Exec("cat /proc/loadavg | cut -d' ' -f-3 | tr -d '\n'", &temp2);
if(temp2 != "") {
dom.GetObject(ID_SYSTEM_VARIABLES).Get("CPU_Load").State(temp2);
}
string temp3;
system.Exec("free -m | grep Mem: | awk '{ printf(\"%.1f\", $3/$2*100) }'", &temp3);
if(temp3 != "") {
dom.GetObject(ID_SYSTEM_VARIABLES).Get("CCU_RAM_Usage").State(temp3);
}
string temp4;
system.Exec("awk '{s=int($1);d=int(s/86400);h=int(s % 86400/3600);m=int(s % 3600 / 60); printf \"%d days, %02d:%02d\", d, h, m}' /proc/uptime", &temp4);
if(temp4 != "") {
dom.GetObject(ID_SYSTEM_VARIABLES).Get("CCU_SYS_Uptime").State(temp4);
}