17 lines
431 B
Bash
Executable File
17 lines
431 B
Bash
Executable File
#!/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]}
|
|
|
|
local class=good
|
|
local nproc=$(nproc)
|
|
if [[ ${load} -gt $(( ${nproc} + 1 )) ]]; then
|
|
class=critical
|
|
elif [[ ${load} -gt $(( ${nproc} + 0.2 )) ]]; then
|
|
class=warning
|
|
fi
|
|
|
|
print -l ${load} ${load_all} ${class}
|