From 6e54ca3045d80e97c1ad88c772062d3d1aded50c Mon Sep 17 00:00:00 2001 From: Zev Benjamin Date: Mon, 23 Sep 2013 14:22:15 -0400 Subject: [PATCH] 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) --- .../zulip/files/cron.d/rabbitmq-numconsumers | 8 ++++---- tools/write-rabbitmq-consumers-state-file | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) create mode 100755 tools/write-rabbitmq-consumers-state-file diff --git a/servers/puppet/modules/zulip/files/cron.d/rabbitmq-numconsumers b/servers/puppet/modules/zulip/files/cron.d/rabbitmq-numconsumers index 0f076bc64d..f4ca77e8a8 100644 --- a/servers/puppet/modules/zulip/files/cron.d/rabbitmq-numconsumers +++ b/servers/puppet/modules/zulip/files/cron.d/rabbitmq-numconsumers @@ -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 diff --git a/tools/write-rabbitmq-consumers-state-file b/tools/write-rabbitmq-consumers-state-file new file mode 100755 index 0000000000..926a3e849f --- /dev/null +++ b/tools/write-rabbitmq-consumers-state-file @@ -0,0 +1,15 @@ +#!/bin/bash -e + +queue=$1 + +if [ -z "$queue" ]; then + echo "Usage: $0 " + 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