diff --git a/scripts/nagios/check-rabbitmq-consumers b/scripts/nagios/check-rabbitmq-consumers index f6bb04d747..0930d1a09d 100755 --- a/scripts/nagios/check-rabbitmq-consumers +++ b/scripts/nagios/check-rabbitmq-consumers @@ -2,7 +2,7 @@ import sys import time -import optparse +import argparse from collections import defaultdict import os import subprocess @@ -23,14 +23,14 @@ if 'USER' in os.environ and not os.environ['USER'] in ['root', 'rabbitmq']: usage = """Usage: check-rabbitmq-consumers --queue=[queue-name] --min-threshold=[min-threshold]""" -parser = optparse.OptionParser(usage=usage) -parser.add_option('--min-threshold', - dest='min_count', - type="int", - default=1, - action='store') +parser = argparse.ArgumentParser(usage=usage) +parser.add_argument('--min-threshold', + dest='min_count', + type=int, + default=1, + action='store') -(options, args) = parser.parse_args() +options = parser.parse_args() output = subprocess.check_output(['/usr/sbin/rabbitmqctl', 'list_consumers'], universal_newlines=True)