diff options
author | Simon Rettberg | 2020-04-30 17:27:17 +0200 |
---|---|---|
committer | Simon Rettberg | 2020-04-30 17:27:17 +0200 |
commit | 4f64ad32c4b61155e0dee196d39a638f4e9819f1 (patch) | |
tree | 0e776b2f4b599b327912cba3d30635285eb1821d /core/modules/hardware-stats | |
parent | [hardware-stats] Fix CPU load script (diff) | |
download | mltk-4f64ad32c4b61155e0dee196d39a638f4e9819f1.tar.gz mltk-4f64ad32c4b61155e0dee196d39a638f4e9819f1.tar.xz mltk-4f64ad32c4b61155e0dee196d39a638f4e9819f1.zip |
[hardware-stats] ...
Diffstat (limited to 'core/modules/hardware-stats')
-rwxr-xr-x | core/modules/hardware-stats/data/opt/openslx/scripts/cron-system_usage_update | 4 |
1 files changed, 2 insertions, 2 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 c162fec4..64bd7729 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 @@ -58,7 +58,7 @@ if $full; then # sloppy way to prevent rapid updates; counter speed varies depending on HZ and core count if [ "$(( c_count - l_count ))" -gt 12000 ]; then write=true - set -- "$@" "--data-urlencode" "cputemp=$( echo "$current $old" | awk '{ print (100 - ($1 - $3)/($2 - $4) * 100) }' )" + set -- "$@" "--data-urlencode" "cpuload=$( echo "$current $old" | awk '{ print (100 - ($1 - $3)/($2 - $4) * 100) }' )" fi else write=true @@ -69,7 +69,7 @@ if $full; then if command -v sensors > /dev/null; 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" "cpuload=$( sensors | tr 'A-Z' 'a-z' \ + 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);}' )" fi fi |