Correct some PEP on the brand new RabbitMQ export module

pull/544/head
nicolargo 2015-04-12 21:40:46 +02:00
parent e0205a9e4a
commit 49a579d6d1
5 changed files with 15 additions and 7 deletions

3
NEWS
View File

@ -10,7 +10,8 @@ Enhancements and news features:
* Grab FAN speed in the Glances sensors plugin (issue #501)
* Allow logical mounts points in the FS plugin (issue #448)
* Add a --disable-hddtemp to disable HDD temperature module at startup (issue #515)
* Add a quiet mode (-q). Can be usefull if you need a Statsd or Influxdb provider only.
* Add a quiet mode (-q). Can be usefull if you need a Statsd or Influxdb provider only
* Add RabbitMQ export module (issue #540 Thk to @Katyucha)
Bugs corrected:

View File

@ -186,3 +186,10 @@ db=glances
host=localhost
port=8125
#prefix=glances
[rabbitmq]
host=localhost
port=5672
user=guest
password=guest
queue=glances_queue

View File

@ -181,6 +181,6 @@ port=8125
[rabbitmq]
host=localhost
port=5672
user=glances
password=glances
user=guest
password=guest
queue=glances_queue

View File

@ -81,7 +81,7 @@ class Export(GlancesExport):
"""Init the connection to the rabbitmq server"""
if not self.export_enable:
return None
try:
try:
parameters = pika.URLParameters("amqp://"+self.rabbitmq_user+":"+self.rabbitmq_password+"@"+self.rabbitmq_host+":"+self.rabbitmq_port+"/")
connection = pika.BlockingConnection(parameters)
channel = connection.channel()
@ -97,9 +97,9 @@ class Export(GlancesExport):
if not isinstance(points[i], Number):
continue
else:
data += ", "+columns[i]+"="+str(points[i])
data += ", " + columns[i] + "=" + str(points[i])
logger.debug(data)
try:
self.client.basic_publish(exchange='', routing_key="glances_queue", body=data)
self.client.basic_publish(exchange='', routing_key=self.rabbitmq_queue, body=data)
except Exception as e:
logger.error("Can not export stats to RabbitMQ (%s)" % e)

View File

@ -73,7 +73,7 @@ setup(
'BROWSER': ['zeroconf>=0.16', 'netifaces'],
'RAID': ['pymdstat'],
'DOCKER': ['docker-py'],
'EXPORT': ['influxdb>=1.0.0', 'statsd'],
'EXPORT': ['influxdb>=1.0.0', 'statsd', 'pika'],
'ACTION': ['pystache']
},
packages=['glances'],