added process print

This commit is contained in:
mrbesen 2019-07-07 09:41:39 +02:00
parent 250282f78b
commit d5657eb1f8
3 changed files with 12 additions and 2 deletions

6
bot.sh
View File

@ -29,7 +29,8 @@ fi
cpu=$(cpuUsage)
if [ "$cpu" -gt "$cpulimit" ]; then
echo "cpu limit!"
send "warnung%20CPU%20Usage%20is%20high%20$cpu"
proc=$(cpuHighest)
send "warnung%20CPU%20Usage%20is%20high%20$cpu%25%0A$proc"
fi
#mem usage
@ -37,7 +38,8 @@ fi
mem=$(memUsage)
if [ "$mem" -gt "$memlimit" ]; then
echo "mem limit!"
send "warnung%20Memory%20Usage%20is%20high%20$mem%25"
proc=$(memHighest)
send "warnung%20Memory%20Usage%20is%20high%20$mem%25%0A$proc"
fi
#CheckCerts

4
cpu.sh
View File

@ -3,3 +3,7 @@
function cpuUsage {
ps -A -o pcpu | tail -n+2 | paste -sd+ | bc | awk '{print int($1)}'
}
function cpuHighest {
ps -eo pid,cmd,%cpu --sort=-%cpu | head -2 | tail -n 1
}

4
mem.sh
View File

@ -2,3 +2,7 @@
function memUsage {
top -bn1 | sed -n 4p | awk '{ print int( $6 / $4 * 100) }'
}
function memHighest {
ps -eo pid,cmd,%mem --sort=-%mem | head -2 | tail -n 1
}