diff options
Diffstat (limited to 'glances/exports/glances_rabbitmq.py')
-rw-r--r-- | glances/exports/glances_rabbitmq.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/glances/exports/glances_rabbitmq.py b/glances/exports/glances_rabbitmq.py index e8f48d1a..58701983 100644 --- a/glances/exports/glances_rabbitmq.py +++ b/glances/exports/glances_rabbitmq.py @@ -44,6 +44,7 @@ class Export(GlancesExport): self.user = None self.password = None self.queue = None + self.protocol = None # Optionals configuration keys # N/A @@ -53,7 +54,7 @@ class Export(GlancesExport): mandatories=['host', 'port', 'user', 'password', 'queue'], - options=[]) + options=['protocol']) if not self.export_enable: sys.exit(2) @@ -67,9 +68,18 @@ class Export(GlancesExport): """Init the connection to the rabbitmq server.""" if not self.export_enable: return None + + # Needed for when protocol is not specified and when protocol is upper case + # only amqp and amqps supported + if self.protocol is not None and (self.protocol.lower() == 'amqps'): + self.protocol = 'amqps' + else: + self.protocol = 'amqp' + try: parameters = pika.URLParameters( - 'amqp://' + self.user + + self.protocol + + '://' + self.user + ':' + self.password + '@' + self.host + ':' + self.port + '/') |