summaryrefslogtreecommitdiffstats
path: root/core/modules/hardware-stats
diff options
context:
space:
mode:
authorSimon Rettberg2022-05-25 12:11:09 +0200
committerSimon Rettberg2022-05-25 12:11:09 +0200
commitc2dfb47c75cd03ea9edbeab0be697c5dbb30eeab (patch)
treefc6a771206cfb200fcf654c7b79eeb65483b596e /core/modules/hardware-stats
parent[vbox-src] Support CONFIG_VBOX_VERSION (diff)
downloadmltk-c2dfb47c75cd03ea9edbeab0be697c5dbb30eeab.tar.gz
mltk-c2dfb47c75cd03ea9edbeab0be697c5dbb30eeab.tar.xz
mltk-c2dfb47c75cd03ea9edbeab0be697c5dbb30eeab.zip
[hardware-stats] CPU temp: Add support for k10temp output format
Diffstat (limited to 'core/modules/hardware-stats')
-rwxr-xr-xcore/modules/hardware-stats/data/opt/openslx/scripts/cron-system_usage_update19
1 files changed, 18 insertions, 1 deletions
diff --git a/core/modules/hardware-stats/data/opt/openslx/scripts/cron-system_usage_update b/core/modules/hardware-stats/data/opt/openslx/scripts/cron-system_usage_update
index cd60c080..cd4f3ea9 100755
--- a/core/modules/hardware-stats/data/opt/openslx/scripts/cron-system_usage_update
+++ b/core/modules/hardware-stats/data/opt/openslx/scripts/cron-system_usage_update
@@ -75,7 +75,24 @@ if $full; then
# TODO JSON support arrived recently, port after base system is updated from 18.04
# Try to get the package id reading, use core temps as fallback
set -- "$@" "--data-urlencode" "cputemp=$( sensors | tr 'A-Z' 'a-z' \
- | awk 'BEGIN{p=0;pc=0;c=0;cc=0} {if ($1 == "package" && substr($4, 1, 1) == "+") {gsub("[^0-9.]", "", $4); p += $4; pc++} if ($1 ~ /^core/ && substr($3, 1, 1) == "+") {gsub("[^0-9.]", "", $3); c += $3; cc++} } END{if (pc > 0) print (p / pc); else if (cc > 0) print (c / cc);}' )"
+ | awk 'BEGIN{p=0;pc=0;c=0;cc=0;tctl=0} {
+ if ($1 == "package" && substr($4, 1, 1) == "+") {
+ gsub("[^0-9.]", "", $4);
+ p += $4;
+ pc++;
+ } else if ($1 ~ /^core/ && substr($3, 1, 1) == "+") {
+ gsub("[^0-9.]", "", $3);
+ c += $3;
+ cc++;
+ } else if ($1 ~ /^tctl:/ && substr($2, 1, 1) == "+") {
+ gsub("[^0-9.]", "", $2);
+ tctl = $2;
+ }
+ } END {
+ if (pc > 0) print (p / pc);
+ else if (cc > 0) print (c / cc);
+ else if (tctl > 0) print (tctl);
+ }' )"
fi
fi