diff --git a/scripts/nagios/check-rabbitmq-queue b/scripts/nagios/check-rabbitmq-queue index 768e0b16a2..1e2272eec4 100755 --- a/scripts/nagios/check-rabbitmq-queue +++ b/scripts/nagios/check-rabbitmq-queue @@ -32,15 +32,15 @@ states = { } pattern = re.compile(r'(\w+)\t(\d+)') +if 'USER' in os.environ and not os.environ['USER'] in ['root', 'rabbitmq']: + print("This script must be run as the root or rabbitmq user") + output = subprocess.check_output(['/usr/sbin/rabbitmqctl', 'list_queues'], universal_newlines=True) status = 0 max_count = 0 warn_queues = [] -if 'USER' in os.environ and not os.environ['USER'] in ['root', 'rabbitmq']: - print("This script must be run as the root or rabbitmq user") - for line in output.split("\n"): line = line.strip() m = pattern.match(line)