commiting all
This commit is contained in:
parent
233697cd0a
commit
565b86e547
|
@ -18,8 +18,10 @@ use the df.conf.sample to create a config and put this file anywhere on the same
|
|||
http://gitorious.org/sn/scripts/trees/master/mobots/df.conf.sample
|
||||
|
||||
3. create a cronjob for it
|
||||
add a line like this to your /etc/crontab (here the script is executed all 2 minutes)
|
||||
add a line like this to your /etc/crontab
|
||||
*/2 * * * * root /bin/bash --login /path/to/the/script/df.sh /path/to/configfile/df.conf >> /path/to/logfile/df.log
|
||||
or (if you use the default configpath /etc/mobots)
|
||||
*/5 * * * * root /bin/bash --login /path/to/script/df.sh >> /var/log/df.log
|
||||
|
||||
after this you have to restart your cron with something like
|
||||
service cron restart
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
## ##
|
||||
###################################################
|
||||
|
||||
## timestamp for logfile
|
||||
timestamp=$(date '+%d %B %Y %H:%M')
|
||||
echo "info: starting df bot $timestamp"
|
||||
|
||||
## check if sendxmpp is installed
|
||||
if [ $(aptitude search sendxmpp | awk '{print $1}') = "i" ]; then
|
||||
|
@ -61,12 +64,13 @@ do
|
|||
datathreshold=$(echo $thresholds | awk '{print $'$i'}')
|
||||
|
||||
if [ $data -gt $datathreshold ]; then
|
||||
echo "info: $var reached threshold with $data, sending notification"
|
||||
echo "$hostname: $var is running out of space: $data%" | sendxmpp -r dfmobot $watchdogs
|
||||
echo "info: $var reached threshold with $data%, sending notification to $watchdogs"
|
||||
echo "$hostname: $var is running out of space: $data%" | sendxmpp -r dfbot $watchdogs
|
||||
fi
|
||||
let i++
|
||||
done
|
||||
|
||||
|
||||
## exiting
|
||||
echo "info: done"
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue