mirror of
https://github.com/nicolargo/glances.git
synced 2024-11-24 13:23:12 +03:00
Merge branch 'develop' into issue1446
This commit is contained in:
commit
20ca58d5a4
2
NEWS
2
NEWS
@ -15,6 +15,8 @@ Bugs corrected:
|
||||
|
||||
* Fix Cassandra table name export #1402
|
||||
* 500 Internal Server Error /api/3/network/interface_name #1401
|
||||
* Connection to MQTT server failed : getaddrinfo() argument 2 must be integer or string #1450
|
||||
* `l` keypress (hide alert log) not working after some time #1449
|
||||
|
||||
Others:
|
||||
|
||||
|
@ -413,6 +413,7 @@ port=8883
|
||||
user=guest
|
||||
password=guest
|
||||
topic=glances
|
||||
tls=true
|
||||
|
||||
[couchdb]
|
||||
# Configuration for the --export couchdb option
|
||||
|
@ -42,20 +42,22 @@ class Export(GlancesExport):
|
||||
self.user = None
|
||||
self.password = None
|
||||
self.topic = None
|
||||
self.tls = 'true'
|
||||
|
||||
# Load the MQTT configuration file
|
||||
self.export_enable = self.load_conf('mqtt',
|
||||
mandatories=['host', 'password'],
|
||||
options=['port', 'user', 'topic'])
|
||||
options=['port', 'user', 'topic', 'tls'])
|
||||
if not self.export_enable:
|
||||
exit('Missing MQTT config')
|
||||
|
||||
# Get the current hostname
|
||||
self.hostname = socket.gethostname()
|
||||
|
||||
self.port = self.port or 8883
|
||||
self.port = int(self.port) or 8883
|
||||
self.topic = self.topic or 'glances'
|
||||
self.user = self.user or 'glances'
|
||||
self.tls = (self.tls.lower() == 'true')
|
||||
|
||||
# Init the MQTT client
|
||||
self.client = self.init()
|
||||
@ -69,6 +71,7 @@ class Export(GlancesExport):
|
||||
clean_session=False)
|
||||
client.username_pw_set(username=self.user,
|
||||
password=self.password)
|
||||
if self.tls:
|
||||
client.tls_set(certs.where())
|
||||
client.connect(host=self.host,
|
||||
port=self.port)
|
||||
|
@ -114,22 +114,12 @@ class Plugin(GlancesPlugin):
|
||||
ret = []
|
||||
|
||||
# Only process if display plugin enable...
|
||||
if not self.stats and self.is_disable():
|
||||
if not self.stats or self.is_disable():
|
||||
return ret
|
||||
|
||||
# Build the string message
|
||||
# Header
|
||||
ret.append(self.curse_add_line(global_message(), "TITLE"))
|
||||
if self.stats:
|
||||
# Header
|
||||
# msg = 'Warning or critical alerts'
|
||||
# ret.append(self.curse_add_line(msg, "TITLE"))
|
||||
# logs_len = glances_events.len()
|
||||
# if logs_len > 1:
|
||||
# msg = ' (last {} entries)'.format(logs_len)
|
||||
# else:
|
||||
# msg = ' (one entry)'
|
||||
# ret.append(self.curse_add_line(msg, "TITLE"))
|
||||
# Loop over alerts
|
||||
for alert in self.stats:
|
||||
# New line
|
||||
@ -166,7 +156,6 @@ class Plugin(GlancesPlugin):
|
||||
if top_process != '':
|
||||
msg = ': {}'.format(top_process)
|
||||
ret.append(self.curse_add_line(msg))
|
||||
# logger.info(alert)
|
||||
|
||||
return ret
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user