wayar: make loadavg script nicer

This commit is contained in:
tea 2024-06-13 14:44:04 +02:00
parent 8f084c0210
commit de2d5e01bc
No known key found for this signature in database

View File

@ -4,12 +4,13 @@
local load_all=$(cut -d' ' -f1,2,3 /proc/loadavg) local load_all=$(cut -d' ' -f1,2,3 /proc/loadavg)
local load=${${(@s: :)load_all}[1]} local load=${${(@s: :)load_all}[1]}
print -l ${load} ${load_all}
if [[ ${load} -gt $(( $(nproc) + 1 )) ]]; then local class=good
print critical local nproc=$(nproc)
elif [[ ${load} -gt $(nproc) ]]; then if [[ ${load} -gt $(( ${nproc} + 1 )) ]]; then
print warning class=critical
else elif [[ ${load} -gt ${nproc} ]]; then
print good class=warning
fi fi
print -l ${load} ${load_all} ${class}