mirror of https://github.com/nicolargo/glances.git
Graph generation documentation is not clear #2336
This commit is contained in:
parent
4f21b2dcfa
commit
5ef51c2063
754
docs/api.rst
754
docs/api.rst
File diff suppressed because it is too large
Load Diff
|
|
@ -4,7 +4,10 @@ Graph
|
|||
======
|
||||
|
||||
You can generate dynamic graphs (SVG format) in a target folder. The generation
|
||||
starts every time the 'g' key is pressed in the CLI interface.
|
||||
starts every time the 'g' key is pressed in the CLI interface (if Glances has been
|
||||
started with the --export graph option).
|
||||
|
||||
The graph export module can be configured through the Glances configuration file:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
|||
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
|
||||
..
|
||||
.TH "GLANCES" "1" "Mar 11, 2023" "3.4.0_beta1" "Glances"
|
||||
.TH "GLANCES" "1" "Apr 08, 2023" "3.4.0_beta1" "Glances"
|
||||
.SH NAME
|
||||
glances \- An eye on your system
|
||||
.SH SYNOPSIS
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class GlancesExport(object):
|
|||
def __init__(self, config=None, args=None):
|
||||
"""Init the export class."""
|
||||
# Export name (= module name without glances_)
|
||||
self.export_name = self.__class__.__module__[len('glances_') :]
|
||||
self.export_name = self.__class__.__module__[len('glances_'):]
|
||||
logger.debug("Init export module %s" % self.export_name)
|
||||
|
||||
# Init the config & args
|
||||
|
|
@ -102,6 +102,7 @@ class GlancesExport(object):
|
|||
|
||||
def get_item_key(self, item):
|
||||
"""Return the value of the item 'key'."""
|
||||
ret = None
|
||||
try:
|
||||
ret = item[item['key']]
|
||||
except KeyError:
|
||||
|
|
|
|||
|
|
@ -56,12 +56,13 @@ class Export(GlancesExport):
|
|||
sys.exit(2)
|
||||
|
||||
logger.info("Graphs will be created in the {} folder".format(self.path))
|
||||
logger.info("Graphs will be created when 'g' key is pressed (in the CLI interface)")
|
||||
if self.generate_every != 0:
|
||||
logger.info("Graphs will be created automatically every {} seconds".format(self.generate_every))
|
||||
logger.info("or when 'g' key is pressed (only through the CLI interface)")
|
||||
# Start the timer
|
||||
self._timer = Timer(self.generate_every)
|
||||
else:
|
||||
logger.info("Graphs will be created when 'g' key is pressed (in the CLI interface)")
|
||||
self._timer = None
|
||||
|
||||
def exit(self):
|
||||
|
|
@ -84,7 +85,7 @@ class Export(GlancesExport):
|
|||
if plugin_name in self.plugins_to_export(stats):
|
||||
self.export(plugin_name, plugin.get_export_history())
|
||||
|
||||
logger.info("Graphs created in the folder {}".format(self.path))
|
||||
logger.info("Graphs created in {}".format(self.path))
|
||||
self.args.generate_graph = False
|
||||
|
||||
def export(self, title, data):
|
||||
|
|
|
|||
|
|
@ -718,7 +718,11 @@ class _GlancesCurses(object):
|
|||
|
||||
# Display graph generation popup
|
||||
if self.args.generate_graph:
|
||||
self.display_popup('Generate graph in {}'.format(self.args.export_graph_path))
|
||||
if 'graph' in stats.getExportsList():
|
||||
self.display_popup('Generate graph in {}'.format(self.args.export_graph_path))
|
||||
else:
|
||||
logger.warning('Graph export module is disable. Run Glances with --export graph to enable it.')
|
||||
self.args.generate_graph = False
|
||||
|
||||
return True
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue