diff --git a/check b/check index 3825864..c0f9618 100755 --- a/check +++ b/check @@ -166,7 +166,7 @@ function testdf() fi IFS=" " - for ligne in `df -P -l -x tmpfs -x devtmpfs $fs | sed '/Used Available/d'`; do + for ligne in `df -P -l -x tmpfs -x devtmpfs $fs | sed '/Filesystem/d'`; do fs_space=`echo $ligne | awk '{print $5}'| sed 's/\%//'` filesys=`echo $ligne | awk '{print $6}'` if [ $fs_space -gt $limite ]; then @@ -269,6 +269,19 @@ function testNTP() /usr/bin/ntpq -n -c peers | egrep -q '^\*' || checklog "Serveur de temps désynchronisé ou injoignable" } +function testZombie() +{ + # Cette fonction teste les zombies qui trainent sur le système. Elle les tue + for ligne in `ps -eo pid,ppid,state,cmd | grep -v grep | grep ' Z '`; do + echo "Zombie : $ligne" + IFS=" " + for proc in `echo $ligne | awk '{print $1" "$2}'`; do + echo " PROCESSUS TUE :$proc" + kill -9 $proc 2>/dev/null + done + done +} + if [ ! -f "/etc/check.conf" ]; then echo "Le fichier /etc/check.conf n'existe pas : EXIT" exit diff --git a/check.conf b/check.conf index 12a493e..c3de860 100644 --- a/check.conf +++ b/check.conf @@ -66,3 +66,7 @@ alerteNotify=FALSE ## Verifie si le seuil de la batterie est depasse et donc qu'il faut recharger #testBatterie + +## Vérifie si un ou plusieurs processus zombies existent et le tuent +testZombie +