travis: Automate updates to production-helper Nagios test.

This list was likely to end up out of date quickly, since it wasn't
documented that you need to update it when adding a queue.  The best
solution is to just not require it to be updated.
This commit is contained in:
Tim Abbott 2017-02-19 13:18:18 -08:00
parent 8da7976058
commit d6bbcd2737
3 changed files with 31 additions and 1 deletions

26
scripts/lib/queue_workers.py Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env python
from __future__ import print_function
import argparse
import os
import sys
from os.path import dirname, abspath
BASE_DIR = dirname(dirname(dirname(abspath(__file__))))
sys.path.append(BASE_DIR)
import scripts.lib.setup_path_on_import
os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.settings'
import django
django.setup()
from zerver.worker.queue_processors import get_active_worker_queues
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--queue_type', action='store', dest='queue_type', default=None,
help="Specify which types of queues to list")
args = parser.parse_args()
workers = get_active_worker_queues(args.queue_type)
print(" ".join(workers))

View File

@ -17,6 +17,7 @@ sanity_check.check_venv(__file__)
from typing import IO, Text
# TODO: Convert this to use scripts/lib/queue_workers.py
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
successful_worker_launches = [
'launching queue worker thread error_reports',

View File

@ -86,7 +86,10 @@ fi
echo; echo "Now running RabbitMQ consumer Nagios tests"; echo
# First run the check that usually runs in cron and populates the state files
/home/zulip/deployments/current/scripts/nagios/check-rabbitmq-consumers
for consumer in notify_tornado user_activity user_activity_interval user_presence invites signups message_sender feedback_messages error_reports digest_emails email_mirror missedmessage_mobile_notifications; do
# Then, compute the list of all Django queue workers to run Nagios checks against
consumer_list=$(/home/zulip/deployments/current/scripts/lib/queue_workers.py --queue_type=consumer)
for consumer in $consumer_list; do
if ! /usr/lib/nagios/plugins/zulip_app_frontend/check_rabbitmq_consumers "$consumer"; then
set +x
echo