diff options
author | Simon Rettberg | 2019-01-25 16:57:46 +0100 |
---|---|---|
committer | Simon Rettberg | 2019-01-25 16:57:46 +0100 |
commit | 8590b0204082bd0e366034cb89e92fe90e0d6bc7 (patch) | |
tree | 478ada42e41d01e81ac925a79482fd58b78eddd0 /core/modules/hardware-stats/data | |
parent | [rootfs-stage32] Sort kernel modules in .conf, delete REQUIRED_FIRMWARE (diff) | |
download | mltk-8590b0204082bd0e366034cb89e92fe90e0d6bc7.tar.gz mltk-8590b0204082bd0e366034cb89e92fe90e0d6bc7.tar.xz mltk-8590b0204082bd0e366034cb89e92fe90e0d6bc7.zip |
[hardware-stats] Prefer MemAvailable if present...
Fallback is MemFree + Buffers + Cached which might overshoot
Diffstat (limited to 'core/modules/hardware-stats/data')
-rwxr-xr-x | core/modules/hardware-stats/data/opt/openslx/scripts/cron-system_usage_update | 5 |
1 files changed, 4 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 a4b1dbe2..c67b729c 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 @@ -31,7 +31,10 @@ TMP_FREE=$(echo $TMP | awk '{print $4}') SWAP_SIZE=$( awk '{if ($1 == "SwapTotal:") { print $2; exit; }}' /proc/meminfo ) SWAP_FREE=$( awk '{if ($1 == "SwapFree:") { print $2; exit; }}' /proc/meminfo ) MEM_SIZE=$( awk '{if ($1 == "MemTotal:") { print $2; exit; }}' /proc/meminfo ) -MEM_FREE=$( awk 'BEGIN{n=0}{if ($1 == "MemAvailable:" || $1 == "Buffers:" || $1 == "Cached:") n += $2}END{print n}' /proc/meminfo ) +MEM_FREE=$( awk '{if ($1 == "MemAvailable:") { print $2; exit; }}' /proc/meminfo ) +if [ -n "$MEM_FREE" ]; then + MEM_FREE=$( awk 'BEGIN{n=0}{if ($1 == "MemFree:" || $1 == "Buffers:" || $1 == "Cached:") n += $2}END{print n}' /proc/meminfo ) +fi if [ -n "$SLX_EXAM" ]; then # This isn't an actual runmode, but in case exam mode is active on a client you definitely want # to know about it, more than other runmodes actually |