mirror of
https://github.com/nicolargo/glances.git
synced 2024-11-28 14:12:21 +03:00
Correct some PEP on the brand new RabbitMQ export module
This commit is contained in:
parent
e0205a9e4a
commit
49a579d6d1
3
NEWS
3
NEWS
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user