puppet: Factor out writing the rabbitmq consumer check state file into its own script

This temporarily breaks the rabbitmq consumer checks for the
user_activity and notify_tornado queues because their state files
were renamed to match their queue names.  It will be fixed for
staging in the next commit.

(imported from commit a6aaa330a1134d8ddffe8f4959deb12b219f241a)
This commit is contained in:
Zev Benjamin 2013-09-23 14:22:15 -04:00
parent 101a70a7ce
commit 6e54ca3045
2 changed files with 19 additions and 4 deletions

View File

@ -2,7 +2,7 @@ SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
USER=root
* * * * * root /home/humbug/humbug-deployments/current/bots/check-rabbitmq-consumers --queue=notify_tornado &> /var/lib/nagios_state/check-rabbitmq-consumers-tornado-tmp; mv /var/lib/nagios_state/check-rabbitmq-consumers-tornado-tmp /var/lib/nagios_state/check-rabbitmq-consumers-tornado
* * * * * root /home/humbug/humbug-deployments/current/bots/check-rabbitmq-consumers --queue=user_activity &> /var/lib/nagios_state/check-rabbitmq-consumers-useractivity-tmp; mv /var/lib/nagios_state/check-rabbitmq-consumers-useractivity-tmp /var/lib/nagios_state/check-rabbitmq-consumers-useractivity
* * * * * root /home/humbug/humbug-deployments/current/bots/check-rabbitmq-consumers --queue=invites &> /var/lib/nagios_state/check-rabbitmq-consumers-invites-tmp; mv /var/lib/nagios_state/check-rabbitmq-consumers-invites-tmp /var/lib/nagios_state/check-rabbitmq-consumers-invites
* * * * * root /home/humbug/humbug-deployments/current/bots/check-rabbitmq-consumers --queue=signups &> /var/lib/nagios_state/check-rabbitmq-consumers-signups-tmp; mv /var/lib/nagios_state/check-rabbitmq-consumers-signups-tmp /var/lib/nagios_state/check-rabbitmq-consumers-signups
* * * * * root /home/humbug/humbug-deployments/current/tools/write-rabbitmq-consumers-state-file notify_tornado
* * * * * root /home/humbug/humbug-deployments/current/tools/write-rabbitmq-consumers-state-file user_activity
* * * * * root /home/humbug/humbug-deployments/current/tools/write-rabbitmq-consumers-state-file invites
* * * * * root /home/humbug/humbug-deployments/current/tools/write-rabbitmq-consumers-state-file signups

View File

@ -0,0 +1,15 @@
#!/bin/bash -e
queue=$1
if [ -z "$queue" ]; then
echo "Usage: $0 <queue-name>"
exit 2
fi
ZULIP_DIR=/home/humbug/humbug-deployments/current
STATE_DIR=/var/lib/nagios_state
STATE_FILE=$STATE_DIR/check-rabbitmq-consumers-$queue
$ZULIP_DIR/bots/check-rabbitmq-consumers --queue=$queue &> ${STATE_FILE}-tmp;
mv ${STATE_FILE}-tmp $STATE_FILE