1
1
scripts/mobots/df.sh

36 lines
904 B
Bash
Raw Normal View History

2010-06-30 23:58:23 +02:00
#########################################
## disk_free jabber monitoring bot ##
## Author: david@socialnerds.org ##
## v0.1 ##
#########################################
2010-06-29 23:31:23 +02:00
2010-06-30 23:58:23 +02:00
## configuration section (does a simple check if the configfile exists)
2010-06-29 23:31:23 +02:00
configfilepath=$(pwd)
2010-06-30 23:58:23 +02:00
configfilepath=/home/david/Documents/sn/scripts/mobots
2010-06-29 23:31:23 +02:00
if [ -f $configfilepath/df.conf ]; then
source $configfilepath/df.conf
else
echo "Exiting because there is no config file."
exit 1
fi
## check disks
2010-06-30 23:58:23 +02:00
set -- $disks
i="1"
2010-06-29 23:31:23 +02:00
2010-06-30 23:58:23 +02:00
for var in "$@"
do
data=$(df -Ph | grep $var | sed -e 's/%//g' | awk '{print $5}')
datathreshold=$(echo $thresholds | awk '{print $'$i'}')
2010-06-29 23:31:23 +02:00
2010-06-30 23:58:23 +02:00
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
2010-06-29 23:31:23 +02:00
2010-06-30 23:58:23 +02:00
let i++
done
2010-06-29 23:31:23 +02:00
## exiting
exit 0