提交 49a579d6 编写于 作者: N nicolargo

Correct some PEP on the brand new RabbitMQ export module

上级 e0205a9e
......@@ -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:
......
......@@ -186,3 +186,10 @@ db=glances
host=localhost
port=8125
#prefix=glances
[rabbitmq]
host=localhost
port=5672
user=guest
password=guest
queue=glances_queue
......@@ -181,6 +181,6 @@ port=8125
[rabbitmq]
host=localhost
port=5672
user=glances
password=glances
user=guest
password=guest
queue=glances_queue
......@@ -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)
......@@ -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'],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册