34 lines
853 B
Bash
34 lines
853 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
|
||
|
processors="$(cat /proc/cpuinfo | grep processor -c)"
|
||
|
warn1perc="70"
|
||
|
warn5perc="60"
|
||
|
warn15perc="50"
|
||
|
|
||
|
crit1perc="90"
|
||
|
crit5perc="80"
|
||
|
crit15perc="70"
|
||
|
|
||
|
|
||
|
#Formel
|
||
|
|
||
|
# y = c * p / 100
|
||
|
# y: nagios value
|
||
|
# c: number of cores
|
||
|
# p: wanted load procent
|
||
|
|
||
|
# 4 cores
|
||
|
# time 1 minutes 10 minutes 15 minutes
|
||
|
# warning: 90% 70% 50%
|
||
|
# critical: 100% 80% 60%
|
||
|
|
||
|
warn1=$(echo "scale=2; $processors * $warn1perc / 100" | bc)
|
||
|
warn5=$(echo "scale=2; $processors * $warn5perc / 100" | bc)
|
||
|
warn15=$(echo "scale=2; $processors * $warn15perc / 100" | bc)
|
||
|
crit1=$(echo "scale=2; $processors * $crit1perc / 100" | bc)
|
||
|
crit5=$(echo "scale=2; $processors * $crit5perc / 100" | bc)
|
||
|
crit15=$(echo "scale=2; $processors * $crit15perc / 100" | bc)
|
||
|
|
||
|
echo "check_loadavg -w $warn1,$warn5,$warn15 -c $crit1,$crit5,$crit15"
|