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=${${(@s: :)load_all}[1]}
print -l ${load} ${load_all}
if [[ ${load} -gt $(( $(nproc) + 1 )) ]]; then
print critical
elif [[ ${load} -gt $(nproc) ]]; then
print warning
else
print good
local class=good
local nproc=$(nproc)
if [[ ${load} -gt $(( ${nproc} + 1 )) ]]; then
class=critical
elif [[ ${load} -gt ${nproc} ]]; then
class=warning
fi
print -l ${load} ${load_all} ${class}