16 lines
390 B
Plaintext
16 lines
390 B
Plaintext
|
#!/usr/bin/env zsh
|
||
|
# print 1 minute load average with tooltip for 1, 5 and 15 minutes
|
||
|
# emit 3 classes: good, warning, critical
|
||
|
|
||
|
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
|
||
|
fi
|