1
1
scripts/mobots/df.sh
2010-06-30 23:58:23 +02:00

36 lines
904 B
Bash
Executable File

#########################################
## disk_free jabber monitoring bot ##
## Author: david@socialnerds.org ##
## v0.1 ##
#########################################
## configuration section (does a simple check if the configfile exists)
configfilepath=$(pwd)
configfilepath=/home/david/Documents/sn/scripts/mobots
if [ -f $configfilepath/df.conf ]; then
source $configfilepath/df.conf
else
echo "Exiting because there is no config file."
exit 1
fi
## check disks
set -- $disks
i="1"
for var in "$@"
do
data=$(df -Ph | grep $var | sed -e 's/%//g' | awk '{print $5}')
datathreshold=$(echo $thresholds | awk '{print $'$i'}')
if [ $data -gt $datathreshold ]; then
echo "$hostname -- $var is running out of space: $data%" | sendxmpp -r dfmobot -u $user -j $server -p $pass $watchdogs
fi
let i++
done
## exiting
exit 0