提交 f354d1a2 编写于 作者: N nicolargo

Correct issue with bad key for AMPS

上级 e135dc33
......@@ -10,8 +10,8 @@ refresh=2
# Does Glances should check if a newer version is available on PyPI ?
check_update=false
# History size (maximum number of values)
# Default is 28800: 1 day with 1 point every 3 seconds
history_size=28800
# Default is 3600 seconds (1 hour)
history_size=3600
##############################################################################
# User interface
......@@ -388,6 +388,10 @@ max_name_size=20
# Set the following key to True to display all containers
all=False
[amps]
# AMPs configuration are defined in the bottom of this file
disable=False
##############################################################################
# Client/server
##############################################################################
......
......@@ -5,7 +5,7 @@ InfluxDB
You can export statistics to an ``InfluxDB`` server (time series server).
In Glances version 3.1.8 and higher, the way Glances exports stats to
In Glances version 3.2.0 and higher, the way Glances exports stats to
InfluxDB changes. The following fields will be added as tags:
- key stats (for example *interface_name* for network, container *name* for docker...)
......@@ -21,10 +21,15 @@ Glances InfluxDB data model:
| | system | |
| | iowait... | |
+---------------+-----------------------+-----------------------+
| network | rx | |
| | tx | |
| | time_since_update... | hostname |
|  | | interface_name |
| network | read_bytes | hostname |
| | write_bytes | disk_name |
| | time_since_update... | |
|  | | |
+---------------+-----------------------+-----------------------+
| diskio | rx | hostname |
| | tx | interface_name |
| | time_since_update... | |
|  | | |
+---------------+-----------------------+-----------------------+
| docker | cpu_percent | hostname |
| | memory_usage... | name |
......
.\" Man page generated from reStructuredText.
.
.TH "GLANCES" "1" "May 29, 2021" "3.1.8b9" "Glances"
.TH "GLANCES" "1" "Jun 05, 2021" "3.2.0b0" "Glances"
.SH NAME
glances \- An eye on your system
.
......
......@@ -29,7 +29,7 @@ import sys
# Global name
# Version should start and end with a numerical char
# See https://packaging.python.org/specifications/core-metadata/#version
__version__ = '3.1.8b9'
__version__ = '3.2.0b0'
__author__ = 'Nicolas Hennion <nicolas@nicolargo.com>'
__license__ = 'LGPLv3'
......
......@@ -65,7 +65,7 @@ class GlancesStdoutIssue(object):
def print_version(self):
msg = 'Glances version {} with PsUtil {}'.format(
colors.BLUE + __version__ + colors.NO,
colors.BLUE + __version__ + colors.NO,
colors.BLUE + psutil_version + colors.NO)
sys.stdout.write('='*len(msg) + '\n')
sys.stdout.write(msg)
......@@ -89,7 +89,7 @@ class GlancesStdoutIssue(object):
if stats._plugins[plugin].is_disable():
# If current plugin is disable
# then continue to next plugin
result = colors.ORANGE + '[N/A]'.rjust(19 - len(plugin))
result = colors.NO + '[N/A]'.rjust(19 - len(plugin))
message = colors.NO
self.print_issue(plugin, result, message)
continue
......@@ -109,14 +109,18 @@ class GlancesStdoutIssue(object):
result = (colors.GREEN +
'[OK] ' +
colors.BLUE +
' {:.4f}s '.format(counter.get())).rjust(40 - len(plugin))
message = colors.NO + str(stat)[0:TERMINAL_WIDTH-40]
' {:.5f}s '.format(counter.get())).rjust(41 - len(plugin))
if isinstance(stat, list) and len(stat) > 0 and 'key' in stat[0]:
key = 'key={} '.format(stat[0]['key'])
message = colors.ORANGE + key + colors.NO + str(stat)[0:TERMINAL_WIDTH-41-len(key)]
else:
message = colors.NO + str(stat)[0:TERMINAL_WIDTH-41]
else:
result = (colors.RED +
'[ERROR]' +
colors.BLUE +
' {:.4f}s '.format(counter.get())).rjust(40 - len(plugin))
message = colors.NO + str(stat_error)[0:TERMINAL_WIDTH-40]
' {:.5f}s '.format(counter.get())).rjust(41 - len(plugin))
message = colors.NO + str(stat_error)[0:TERMINAL_WIDTH-41]
self.print_issue(plugin, result, message)
# Return True to exit directly (no refresh)
......
......@@ -41,6 +41,10 @@ class Plugin(GlancesPlugin):
# Init the list of AMP (classe define in the glances/amps_list.py script)
self.glances_amps = glancesAmpsList(self.args, self.config)
def get_key(self):
"""Return the key of the list."""
return 'name'
@GlancesPlugin._check_decorator
@GlancesPlugin._log_result_decorator
def update(self):
......@@ -50,7 +54,7 @@ class Plugin(GlancesPlugin):
if self.input_method == 'local':
for k, v in iteritems(self.glances_amps.update()):
stats.append({'key': k,
stats.append({'key': self.get_key(),
'name': v.NAME,
'result': v.result(),
'refresh': v.refresh(),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册