From 08ce5ed258bef942a4552b871c3a1b4cb3904ed0 Mon Sep 17 00:00:00 2001 From: lars Date: Mon, 10 Apr 2006 10:15:09 +0000 Subject: [PATCH] IP address added to warning mail --- spielspass/capacity_check.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spielspass/capacity_check.sh b/spielspass/capacity_check.sh index 682f2fc..ae18faa 100755 --- a/spielspass/capacity_check.sh +++ b/spielspass/capacity_check.sh @@ -3,12 +3,14 @@ MAX=15 ## looks for mounted filesystems, but not proc,sys,... DISKS=`mount |grep -iv proc |grep -iv sysfs |awk '{print $3}'` + # retrieve the IP, as the hostname is not always unique + IP=$(/sbin/ifconfig eth0 | grep "inet addr:" | sed 's/^.*inet addr:\([0-9\.]*\).*$/\1/') for DISK in $DISKS; do USAGE=`df -k $DISK | tail -n 1 | awk '{print $5}' | cut -d"%" -f1` # if no number is given as percentage, do nothing - echo "$USAGE" |grep -q [0-9] && if [ $USAGE -gt $MAX ]; then - echo "`uname -n` $DISK is at ${USAGE}% capacity" | mail -s "[diskspace] $DISK explodiert gleich" root@mutter.sao + echo "$USAGE" |grep -q [0-9] && if [ "$USAGE" -gt "$MAX" ]; then + echo "`uname -n` ($IP) $DISK is at ${USAGE}% capacity" | mail -s "[diskspace] $DISK explodiert gleich" space@admin.systemausfall.org fi done