mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-29 20:21:35 +03:00
ZeroMQ plugin is now compatible with Python3
This commit is contained in:
parent
74593f13eb
commit
2b0d33889a
@ -10,10 +10,11 @@ to providing stats to multiple services (see list below).
|
||||
:maxdepth: 2
|
||||
|
||||
csv
|
||||
influxdb
|
||||
cassandra
|
||||
opentsdb
|
||||
statsd
|
||||
rabbitmq
|
||||
elastic
|
||||
influxdb
|
||||
opentsdb
|
||||
rabbitmq
|
||||
riemann
|
||||
statsd
|
||||
zeromq
|
||||
|
@ -23,14 +23,13 @@ import sys
|
||||
from datetime import datetime
|
||||
import time
|
||||
import json
|
||||
import zmq
|
||||
from zmq.utils.strtypes import asbytes
|
||||
|
||||
from glances.compat import NoOptionError, NoSectionError
|
||||
from glances.compat import NoOptionError, NoSectionError, u, b, nativestr
|
||||
from glances.logger import logger
|
||||
from glances.exports.glances_export import GlancesExport
|
||||
|
||||
import zmq
|
||||
|
||||
|
||||
class Export(GlancesExport):
|
||||
|
||||
"""This class manages the ZeroMQ export module."""
|
||||
@ -56,7 +55,7 @@ class Export(GlancesExport):
|
||||
try:
|
||||
self.host = self.config.get_value(section, 'host')
|
||||
self.port = self.config.get_value(section, 'port')
|
||||
self.prefix = self.config.get_value(section, 'prefix')
|
||||
self.prefix = str(self.config.get_value(section, 'prefix'))
|
||||
except NoSectionError:
|
||||
logger.critical("No ZeroMQ configuration found")
|
||||
return False
|
||||
@ -106,9 +105,9 @@ class Export(GlancesExport):
|
||||
# - First frame containing the following prefix (STRING)
|
||||
# - Second frame with the Glances plugin name (STRING)
|
||||
# - Third frame with the Glances plugin stats (JSON)
|
||||
message = [str(self.prefix),
|
||||
name,
|
||||
json.dumps(data)]
|
||||
message = [b(self.prefix),
|
||||
b(name),
|
||||
asbytes(json.dumps(data))]
|
||||
|
||||
# Write data to the ZeroMQ bus
|
||||
# Result can be view: tcp://host:port
|
||||
|
Loading…
Reference in New Issue
Block a user