0735d898fc
use classes for warning and critical
16 lines
390 B
Bash
Executable File
16 lines
390 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]}
|
|
print -l ${load} ${load_all}
|
|
|
|
if [[ ${load} -gt $(( $(nproc) + 1 )) ]]; then
|
|
print critical
|
|
elif [[ ${load} -gt $(nproc) ]]; then
|
|
print warning
|
|
else
|
|
print good
|
|
fi
|