memoryCheck

This commit is contained in:
mrbesen 2019-05-10 20:01:51 +02:00
parent 84dc50a90e
commit b42c0244f1
3 changed files with 16 additions and 0 deletions

10
bot.sh
View File

@ -19,9 +19,19 @@ if [ "$notrunning" != "" ]; then
send "warnung%20the%20following%20services%20are%20not%20running%20$notrunning"
fi
#cpu usage
. cpu.sh
cpu=$(cpuUsage)
if [ "$cpu" -gt "$cpulimit" ]; then
echo "cpu limit!"
send "warnung%20CPU%20Usage%20is%20high%20$cpu"
fi
#mem usage
. mem.sh
mem=$(memUsage)
if [ "$mem" -gt "$memlimit" ]; then
echo "mem limit!"
send "warnung%20Memory%20Usage%20is%20high%20$mem%25"
fi

View File

@ -15,3 +15,5 @@ hddlimit="50"
#harddrive
hdd="/dev/sda1"
memlimit="90"

4
mem.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
function memUsage {
top -bn1 | sed -n 4p | awk '{ print int( $6 / $4 * 100) }'
}