aboutsummaryrefslogtreecommitdiff
path: root/heartbeat_hammer.sh
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-07-14 14:50:22 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-07-14 14:50:22 +0100
commit494b083408b354f38da9b1fc5e8ffb7238d009b3 (patch)
tree4a9122f13b4f36840a2223616b41e3608ae9ba4f /heartbeat_hammer.sh
parente07cea09e884607d6ad005f5e2822251ca31b9ba (diff)
Fixed mauveclient to obey time multipliers
Fixed logrotate script to rotate the correct script Init script now uses the correct user lib/mauve/history.rb is now installed Further logging cleanups
Diffstat (limited to 'heartbeat_hammer.sh')
-rw-r--r--heartbeat_hammer.sh30
1 files changed, 23 insertions, 7 deletions
diff --git a/heartbeat_hammer.sh b/heartbeat_hammer.sh
index 9b60171..de530f2 100644
--- a/heartbeat_hammer.sh
+++ b/heartbeat_hammer.sh
@@ -1,18 +1,34 @@
#!/bin/bash
-PRE="ruby -I lib ./bin/mauveclient localhost"
+PRE="ruby -I lib bin/mauveclient localhost"
+F=60
+n=$*
_host () {
- hostname="imaginary-$i.bytemark.co.uk"
+ hostname="imaginary-$i.example.com"
+ down="n"
+
while( true ) ; do
- sleep $((RANDOM/60))
- echo $hostname
- $PRE -o $hostname -i heartbeat -r +2m -c now -s "heartbeat failed" --detail="<p>The heartbeat wasn't sent for this host</p><p>This indicates that the host might be down</p>"
+
+ if [ "$down" == "n" ] ; then
+ $PRE -o $hostname -i heartbeat -r +$F -c now -s "heartbeat failed" --detail="<p>The heartbeat wasn't sent for this host</p><p>This indicates that the host might be down</p>"
+ sleep $((F - $RANDOM*5/32768 - 5))
+ else
+ sleep $((RANDOM*5/32768 + $F + 5))
+ fi
+
+ if [ $RANDOM -gt 30000 ] ; then
+ [ "$down" == "n" ] && echo "Host $hostname down"
+ down="y"
+ else
+ [ "$down" == "y" ] && echo "Host $hostname up"
+ down="n"
+ fi
done
}
-
-for i in `seq 1 50` ; do
+for i in `seq 1 500` ; do
_host $i &
+ sleep 0.2
done