wayar: make loadavg script nicer
This commit is contained in:
parent
8f084c0210
commit
de2d5e01bc
|
@ -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}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user