aboutsummaryrefslogtreecommitdiff
path: root/utils/heartbeat_hammer.sh
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2017-08-01 11:13:37 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2017-08-01 11:13:37 +0100
commit89f7cb1762a865d72827a024559018efc247e185 (patch)
tree6db3c66f53d68c73ca7da923414fc38cf05813a8 /utils/heartbeat_hammer.sh
parent8a45a5152f953c5573bd18a3bd8b0785f3dea513 (diff)
Removed more cruft. Updated debian/rules to use the Makefile. Updated bundle
Diffstat (limited to 'utils/heartbeat_hammer.sh')
-rw-r--r--utils/heartbeat_hammer.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/utils/heartbeat_hammer.sh b/utils/heartbeat_hammer.sh
new file mode 100644
index 0000000..12b74bc
--- /dev/null
+++ b/utils/heartbeat_hammer.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+PRE="ruby -I lib bin/mauvesend [::1]"
+F=60
+S=10
+n=$*
+
+_host () {
+ hostname="imaginary-$i.example.com"
+ down="n"
+
+ while( true ) ; do
+
+ 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*$S/32768 - $S))
+ else
+ sleep $((RANDOM*$S/32768 + $F + $S))
+ 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
+}
+
+echo -e "This command will go beserk. To kill run\n pkill -t `tty`\n\nGiving you 5 seconds to quit!"
+
+sleep 5
+
+for i in `seq 1 100` ; do
+ _host $i &
+ sleep 0.2
+done
+