diff --git a/docs/api.rst b/docs/api.rst index c41b7bf9..29dd5ade 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -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 diff --git a/docs/conf.py b/docs/conf.py index 6d00a839..12e1fb6c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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'] diff --git a/glances/main.py b/glances/main.py index 54e31de6..f116e8f8 100644 --- a/glances/main.py +++ b/glances/main.py @@ -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 diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py index 90a8823c..6a9c3b4e 100644 --- a/glances/outputs/glances_curses.py +++ b/glances/outputs/glances_curses.py @@ -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 diff --git a/glances/plugins/glances_plugin.py b/glances/plugins/glances_plugin.py index 27e822ce..5b6fb9cc 100644 --- a/glances/plugins/glances_plugin.py +++ b/glances/plugins/glances_plugin.py @@ -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