#!/usr/bin/env python3

"""
Nagios plugin to check that the RabbitMQ queues are not overflowing as a result
of a stuck consumer.

This script just checks the contents of /var/lib/nagios_state/check-rabbitmq-results,
which is generated by scripts/nagios/check-rabbitmq-queue.

It is run by cron; the crontab is in puppet/zulip/files/cron.d/rabbitmq-monitoring
"""
import sys

sys.path.append("/home/zulip/deployments/current/scripts/nagios")
from cron_file_helper import nagios_from_file

RESULTS_FILE = "/var/lib/nagios_state/check-rabbitmq-results"
ret, result = nagios_from_file(RESULTS_FILE)

print(result)
exit(ret)
