40 lines
975 B
Bash
Executable File
40 lines
975 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if ! type bc > /dev/null 2>&1
|
|
then
|
|
echo "bc nicht installiert"
|
|
exit 1
|
|
fi
|
|
|
|
path=$(find /usr/lib* -name check_load)
|
|
processors="$(grep ^processor -c /proc/cpuinfo)"
|
|
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 "command[check_load]=$path -w $warn1,$warn5,$warn15 -c $crit1,$crit5,$crit15"
|