mirror of https://github.com/nicolargo/glances.git
Add --disable-history tag
This commit is contained in:
parent
6a049073da
commit
1ac228787f
|
|
@ -13,5 +13,3 @@ API documentation is available at:
|
|||
|
||||
.. _XML-RPC server: http://docs.python.org/2/library/simplexmlrpcserver.html
|
||||
.. _RESTful-JSON: http://jsonapi.org/
|
||||
|
||||
.. autobottle:: glances.outputs.glances_bottle:GlancesBottle.app
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ from glances import __version__
|
|||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = ['sphinxcontrib.autohttp.bottle']
|
||||
#extensions = ['sphinxcontrib.autohttp.bottle']
|
||||
extensions = []
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
|
|
|||
|
|
@ -142,6 +142,8 @@ Start the client browser (browser mode):\n\
|
|||
dest='disable_amps', help='disable applications monitoring process (AMP) module')
|
||||
parser.add_argument('--disable-log', action='store_true', default=False,
|
||||
dest='disable_log', help='disable log module')
|
||||
parser.add_argument('--disable-history', action='store_true', default=False,
|
||||
dest='disable_history', help='disable stats history')
|
||||
parser.add_argument('--disable-bold', action='store_true', default=False,
|
||||
dest='disable_bold', help='disable bold mode in the terminal')
|
||||
parser.add_argument('--disable-bg', action='store_true', default=False,
|
||||
|
|
@ -149,11 +151,9 @@ Start the client browser (browser mode):\n\
|
|||
parser.add_argument('--enable-process-extended', action='store_true', default=False,
|
||||
dest='enable_process_extended', help='enable extended stats on top process')
|
||||
# Export modules feature
|
||||
# --enable-history is for 2.7< version compatibility
|
||||
parser.add_argument('--export-graph', '--enable-history', action='store_true', default=None,
|
||||
parser.add_argument('--export-graph', action='store_true', default=None,
|
||||
dest='export_graph', help='export stats to graphs')
|
||||
# --path-history is for 2.7< version compatibility
|
||||
parser.add_argument('--path-graph', '--path-history', default=tempfile.gettempdir(),
|
||||
parser.add_argument('--path-graph', default=tempfile.gettempdir(),
|
||||
dest='path_graph', help='set the export path for graphs (default is {0})'.format(tempfile.gettempdir()))
|
||||
parser.add_argument('--export-csv', default=None,
|
||||
dest='export_csv', help='export stats to a CSV file')
|
||||
|
|
@ -345,6 +345,11 @@ Start the client browser (browser mode):\n\
|
|||
sys.exit(2)
|
||||
logger.debug("Graphs output path is set to {0}".format(args.path_graph))
|
||||
|
||||
# For export graph, history is mandatory
|
||||
if args.export_graph and args.disable_history:
|
||||
logger.critical("Can not export graph if history is disabled")
|
||||
sys.exit(2)
|
||||
|
||||
# Disable HDDTemp if sensors are disabled
|
||||
if args.disable_sensors:
|
||||
args.disable_hddtemp = True
|
||||
|
|
|
|||
|
|
@ -764,15 +764,15 @@ class _GlancesCurses(object):
|
|||
self.glances_graph.get_output_folder(),
|
||||
self.glances_graph.generate_graph(stats)))
|
||||
elif self.reset_history_tag and self.args.export_graph:
|
||||
self.display_popup('Reset history')
|
||||
self.display_popup('Reset graph history')
|
||||
self.glances_graph.reset(stats)
|
||||
elif (self.graph_tag or self.reset_history_tag) and not self.args.export_graph:
|
||||
try:
|
||||
self.glances_graph.graph_enabled()
|
||||
except Exception:
|
||||
self.display_popup('History disabled\nEnable it using --export-graph')
|
||||
self.display_popup('Graph disabled\nEnable it using --export-graph')
|
||||
else:
|
||||
self.display_popup('History disabled')
|
||||
self.display_popup('Graph disabled')
|
||||
self.graph_tag = False
|
||||
self.reset_history_tag = False
|
||||
|
||||
|
|
|
|||
|
|
@ -86,25 +86,26 @@ class GlancesPlugin(object):
|
|||
"""Return the key of the list."""
|
||||
return None
|
||||
|
||||
def _history_enable(self):
|
||||
return self.args is not None and not self.args.disable_history and self.get_items_history_list() is not None
|
||||
|
||||
def init_stats_history(self):
|
||||
"""Init the stats history (dict of GlancesAttribute)."""
|
||||
if self.args is not None and self.args.export_graph and self.get_items_history_list() is not None:
|
||||
if self._history_enable():
|
||||
init_list = [a['name'] for a in self.get_items_history_list()]
|
||||
logger.debug("Stats history activated for plugin {0} (items: {1})".format(self.plugin_name, init_list))
|
||||
return GlancesHistory()
|
||||
|
||||
def reset_stats_history(self):
|
||||
"""Reset the stats history (dict of GlancesAttribute)."""
|
||||
if self.args is not None and self.args.export_graph and self.get_items_history_list() is not None:
|
||||
if self._history_enable():
|
||||
reset_list = [a['name'] for a in self.get_items_history_list()]
|
||||
logger.debug("Reset history for plugin {0} (items: {1})".format(self.plugin_name, reset_list))
|
||||
self.stats_history.reset()
|
||||
|
||||
def update_stats_history(self, item_name=''):
|
||||
"""Update stats history."""
|
||||
if (self.stats and self.args is not None and
|
||||
self.args.export_graph and
|
||||
self.get_items_history_list() is not None):
|
||||
if self.stats and self._history_enable():
|
||||
for i in self.get_items_history_list():
|
||||
if isinstance(self.stats, list):
|
||||
# Stats is a list of data
|
||||
|
|
|
|||
Loading…
Reference in New Issue