From 6767a0966e9bd8cbedea408aed2c253b132edc77 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 10 Oct 2015 11:34:03 +0200 Subject: After 2.5.1... --- NEWS | 5 +++++ glances/__init__.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index cbbee262..61e1f2a1 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,11 @@ Glances Version 2 ============================================================================== +Version 2.x +============= + + * ... + Version 2.5.1 ============= diff --git a/glances/__init__.py b/glances/__init__.py index 96467d73..3a5c33cb 100644 --- a/glances/__init__.py +++ b/glances/__init__.py @@ -20,7 +20,7 @@ """Init the Glances software.""" __appname__ = 'glances' -__version__ = '2.5.1' +__version__ = '2.6beta' __author__ = 'Nicolas Hennion ' __license__ = 'LGPL' -- cgit v1.2.3 From 07b62056eeba45676073f7928d19d1d9473cf38c Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 10 Oct 2015 19:18:51 +0200 Subject: Refactor the huge Curses script (first phase, should be continued) --- glances/outputs/glances_curses.py | 151 +++++++++++++++++++++----------------- 1 file changed, 85 insertions(+), 66 deletions(-) diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py index 92bd839f..9d998518 100644 --- a/glances/outputs/glances_curses.py +++ b/glances/outputs/glances_curses.py @@ -70,23 +70,76 @@ class _GlancesCurses(object): logger.critical("Cannot init the curses library.\n") sys.exit(1) - # Set curses options - if hasattr(curses, 'start_color'): - curses.start_color() - if hasattr(curses, 'use_default_colors'): - curses.use_default_colors() + # Init cursor + self._init_cursor() + + # Init the colors + self._init_colors() + + # Init main window + self.term_window = self.screen.subwin(0, 0) + + # Init refresh time + self.__refresh_time = args.time + + # Init edit filter tag + self.edit_filter = False + + # Catch key pressed with non blocking mode + self.no_flash_cursor() + self.term_window.nodelay(1) + self.pressedkey = -1 + + # History tag + self._init_history() + + def _init_history(self): + '''Init the history option''' + + self.reset_history_tag = False + self.history_tag = False + if self.args.enable_history: + logger.info('Stats history enabled with output path %s' % + self.args.path_history) + from glances.exports.glances_history import GlancesHistory + self.glances_history = GlancesHistory(self.args.path_history) + if not self.glances_history.graph_enabled(): + self.args.enable_history = False + logger.error( + 'Stats history disabled because MatPlotLib is not installed') + + def _init_cursor(self): + '''Init cursors''' + if hasattr(curses, 'noecho'): curses.noecho() if hasattr(curses, 'cbreak'): curses.cbreak() self.set_cursor(0) + def _init_colors(self): + '''Init the Curses color layout''' + + # Set curses options + if hasattr(curses, 'start_color'): + curses.start_color() + if hasattr(curses, 'use_default_colors'): + curses.use_default_colors() + # Init colors - self.hascolors = False - if curses.has_colors() and curses.COLOR_PAIRS > 8: - self.hascolors = True - # FG color, BG color - if args.theme_white: + if self.args.disable_bold: + A_BOLD = curses.A_BOLD + else: + A_BOLD = 0 + + self.title_color = A_BOLD + self.title_underline_color = A_BOLD | curses.A_UNDERLINE + self.help_color = A_BOLD + + if curses.has_colors(): + # The screen is compatible with a colored design + if self.args.theme_white: + # White theme: black ==> white curses.init_pair(1, curses.COLOR_BLACK, -1) else: curses.init_pair(1, curses.COLOR_WHITE, -1) @@ -97,34 +150,28 @@ class _GlancesCurses(object): curses.init_pair(6, curses.COLOR_RED, -1) curses.init_pair(7, curses.COLOR_GREEN, -1) curses.init_pair(8, curses.COLOR_BLUE, -1) - try: - curses.init_pair(9, curses.COLOR_MAGENTA, -1) - except Exception: - if args.theme_white: - curses.init_pair(9, curses.COLOR_BLACK, -1) - else: - curses.init_pair(9, curses.COLOR_WHITE, -1) - try: - curses.init_pair(10, curses.COLOR_CYAN, -1) - except Exception: - if args.theme_white: - curses.init_pair(10, curses.COLOR_BLACK, -1) - else: - curses.init_pair(10, curses.COLOR_WHITE, -1) - else: - self.hascolors = False + # Colors text styles + if curses.COLOR_PAIRS > 8: + try: + curses.init_pair(9, curses.COLOR_MAGENTA, -1) + except Exception: + if self.args.theme_white: + curses.init_pair(9, curses.COLOR_BLACK, -1) + else: + curses.init_pair(9, curses.COLOR_WHITE, -1) + try: + curses.init_pair(10, curses.COLOR_CYAN, -1) + except Exception: + if self.args.theme_white: + curses.init_pair(10, curses.COLOR_BLACK, -1) + else: + curses.init_pair(10, curses.COLOR_WHITE, -1) - if args.disable_bold: - A_BOLD = curses.A_BOLD - else: - A_BOLD = 0 + self.ifWARNING_color2 = curses.color_pair(9) | A_BOLD + self.ifCRITICAL_color2 = curses.color_pair(6) | A_BOLD + self.filter_color = curses.color_pair(10) | A_BOLD - self.title_color = A_BOLD - self.title_underline_color = A_BOLD | curses.A_UNDERLINE - self.help_color = A_BOLD - if self.hascolors: - # Colors text styles self.no_color = curses.color_pair(1) self.default_color = curses.color_pair(3) | A_BOLD self.nice_color = curses.color_pair(9) | A_BOLD @@ -134,11 +181,10 @@ class _GlancesCurses(object): self.ifCRITICAL_color = curses.color_pair(2) | A_BOLD self.default_color2 = curses.color_pair(7) | A_BOLD self.ifCAREFUL_color2 = curses.color_pair(8) | A_BOLD - self.ifWARNING_color2 = curses.color_pair(9) | A_BOLD - self.ifCRITICAL_color2 = curses.color_pair(6) | A_BOLD - self.filter_color = curses.color_pair(10) | A_BOLD + else: - # B&W text styles + # The screen is NOT compatible with a colored design + # switch to B&W text styles self.no_color = curses.A_NORMAL self.default_color = curses.A_NORMAL self.nice_color = A_BOLD @@ -175,33 +221,6 @@ class _GlancesCurses(object): 'PASSWORD': curses.A_PROTECT } - # Init main window - self.term_window = self.screen.subwin(0, 0) - - # Init refresh time - self.__refresh_time = args.time - - # Init edit filter tag - self.edit_filter = False - - # Catch key pressed with non blocking mode - self.no_flash_cursor() - self.term_window.nodelay(1) - self.pressedkey = -1 - - # History tag - self.reset_history_tag = False - self.history_tag = False - if args.enable_history: - logger.info('Stats history enabled with output path %s' % - args.path_history) - from glances.exports.glances_history import GlancesHistory - self.glances_history = GlancesHistory(args.path_history) - if not self.glances_history.graph_enabled(): - args.enable_history = False - logger.error( - 'Stats history disabled because MatPlotLib is not installed') - def flash_cursor(self): self.term_window.keypad(1) -- cgit v1.2.3 From bac728e77c70df84fae6d3ef0d94074ebed89eeb Mon Sep 17 00:00:00 2001 From: Floran Brutel Date: Sun, 11 Oct 2015 14:40:24 +0200 Subject: WebUI : hide io R/S if value is not present --- glances/outputs/static/html/plugins/processlist.html | 8 ++++---- glances/outputs/static/js/services/plugins/glances_processlist.js | 8 ++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/glances/outputs/static/html/plugins/processlist.html b/glances/outputs/static/html/plugins/processlist.html index 5e8aeed6..239bacbe 100644 --- a/glances/outputs/static/html/plugins/processlist.html +++ b/glances/outputs/static/html/plugins/processlist.html @@ -9,8 +9,8 @@
NI
S
- - + +
Command
@@ -25,8 +25,8 @@ - - + +
{{process.name}}
{{process.cmdline}}
diff --git a/glances/outputs/static/js/services/plugins/glances_processlist.js b/glances/outputs/static/js/services/plugins/glances_processlist.js index 7a510812..701bc996 100644 --- a/glances/outputs/static/js/services/plugins/glances_processlist.js +++ b/glances/outputs/static/js/services/plugins/glances_processlist.js @@ -1,9 +1,11 @@ glancesApp.service('GlancesPluginProcessList', function($filter, GlancesPlugin) { var _pluginName = "processlist"; + var _ioReadWritePresent = false; this.processes = []; this.setData = function(data, views) { this.processes = []; + this.ioReadWritePresent = false; for (var i = 0; i < data[_pluginName].length; i++) { var process = data[_pluginName][i]; @@ -13,10 +15,12 @@ glancesApp.service('GlancesPluginProcessList', function($filter, GlancesPlugin) process.timeplus = $filter('timedelta')(process.cpu_times); process.timemillis = $filter('timemillis')(process.cpu_times); - process.ioRead = '?'; - process.ioWrite = '?'; + process.ioRead = null; + process.ioWrite = null; if (process.io_counters) { + this.ioReadWritePresent = true; + process.ioRead = (process.io_counters[0] - process.io_counters[2]) / process.time_since_update; if (process.ioRead != 0) { -- cgit v1.2.3 From a9c5adb334e49c5ef86d34a23222b4bda09fa100 Mon Sep 17 00:00:00 2001 From: Alessio Sergi Date: Sun, 11 Oct 2015 16:11:10 +0200 Subject: Fix Celsius to Fahrenheit conversion under Python 3 Exclude battery from conversion too. --- glances/plugins/glances_hddtemp.py | 4 ++-- glances/plugins/glances_sensors.py | 14 +++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/glances/plugins/glances_hddtemp.py b/glances/plugins/glances_hddtemp.py index 972dba4f..318ae3ec 100644 --- a/glances/plugins/glances_hddtemp.py +++ b/glances/plugins/glances_hddtemp.py @@ -118,9 +118,9 @@ class GlancesGrabHDDTemp(object): hddtemp_current = {} device = fields[offset + 1].decode('utf-8') device = os.path.basename(device) - temperature = fields[offset + 3] + temperature = float(fields[offset + 3].decode('utf-8')) hddtemp_current['label'] = device - hddtemp_current['value'] = temperature.decode('utf-8') + hddtemp_current['value'] = temperature self.hddtemp_list.append(hddtemp_current) def fetch(self): diff --git a/glances/plugins/glances_sensors.py b/glances/plugins/glances_sensors.py index 7e4fe4ce..34101727 100644 --- a/glances/plugins/glances_sensors.py +++ b/glances/plugins/glances_sensors.py @@ -45,6 +45,11 @@ else: SENSOR_FAN_UNIT = 'RPM' +def to_fahrenheit(celsius): + """Convert Celsius to Fahrenheit.""" + return celsius * 1.8 + 32 + + class Plugin(GlancesPlugin): """Glances sensors plugin. @@ -202,12 +207,11 @@ class Plugin(GlancesPlugin): if args.fahrenheit: msg = msg.replace('°C', '°F') ret.append(self.curse_add_line(msg)) - if args.fahrenheit: - # Convert Celsius to Fahrenheit - # T(°F) = T(°C) × 1.8 + 32 - msg = '{0:>7}'.format(i['value'] * 1.8 + 32) + if args.fahrenheit and i['type'] != 'battery': + value = to_fahrenheit(i['value']) else: - msg = '{0:>7}'.format(i['value']) + value = i['value'] + msg = '{0:>7.0f}'.format(value) ret.append(self.curse_add_line( msg, self.get_views(item=i[self.get_key()], key='value', -- cgit v1.2.3 From bbf4cffa8639568fb97789c956d2d0cc8fc8d480 Mon Sep 17 00:00:00 2001 From: Alessio Sergi Date: Mon, 12 Oct 2015 17:52:12 +0200 Subject: Add degree symbol in hddtemp --- glances/plugins/glances_hddtemp.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/glances/plugins/glances_hddtemp.py b/glances/plugins/glances_hddtemp.py index 318ae3ec..5b9291bd 100644 --- a/glances/plugins/glances_hddtemp.py +++ b/glances/plugins/glances_hddtemp.py @@ -119,8 +119,10 @@ class GlancesGrabHDDTemp(object): device = fields[offset + 1].decode('utf-8') device = os.path.basename(device) temperature = float(fields[offset + 3].decode('utf-8')) + unit = fields[offset + 4].decode('utf-8') hddtemp_current['label'] = device hddtemp_current['value'] = temperature + hddtemp_current['unit'] = unit self.hddtemp_list.append(hddtemp_current) def fetch(self): -- cgit v1.2.3 From a3f6f81ca49c2eae7b5ab3c5e60e37c1c04f6868 Mon Sep 17 00:00:00 2001 From: Alessio Sergi Date: Mon, 12 Oct 2015 18:12:12 +0200 Subject: Sensors: more uniform display Use the same letter symbol for lm_sensors and hddtemp: - C = Celsius - F = Fahrenheit --- glances/plugins/glances_sensors.py | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/glances/plugins/glances_sensors.py b/glances/plugins/glances_sensors.py index 34101727..193350ef 100644 --- a/glances/plugins/glances_sensors.py +++ b/glances/plugins/glances_sensors.py @@ -26,23 +26,14 @@ try: except ImportError: pass -# Import system libs -import locale - # Import Glances lib -from glances.core.glances_globals import is_py3 from glances.core.glances_logging import logger from glances.plugins.glances_batpercent import Plugin as BatPercentPlugin from glances.plugins.glances_hddtemp import Plugin as HddTempPlugin from glances.plugins.glances_plugin import GlancesPlugin -if is_py3: - SENSOR_TEMP_UNIT = '°C' -else: - # ensure UTF-8 characters are in a charset the terminal can understand - SENSOR_TEMP_UNIT = u'°C '.encode(locale.getpreferredencoding(), 'ignore') - -SENSOR_FAN_UNIT = 'RPM' +SENSOR_TEMP_UNIT = 'C' +SENSOR_FAN_UNIT = 'rpm' def to_fahrenheit(celsius): @@ -200,18 +191,19 @@ class Plugin(GlancesPlugin): label = self.has_alias(i['label'].lower()) if label is None: label = i['label'] - try: - msg = "{0:12} {1:3}".format(label[:11], i['unit']) - except (KeyError, UnicodeEncodeError): - msg = "{0:16}".format(label[:15]) - if args.fahrenheit: - msg = msg.replace('°C', '°F') + if i['type'] != 'fan_speed': + msg = '{0:15}'.format(label[:15]) + else: + msg = '{0:13}'.format(label[:13]) ret.append(self.curse_add_line(msg)) - if args.fahrenheit and i['type'] != 'battery': + if (args.fahrenheit and i['type'] != 'battery' and + i['type'] != 'fan_speed'): value = to_fahrenheit(i['value']) + unit = 'F' else: value = i['value'] - msg = '{0:>7.0f}'.format(value) + unit = i['unit'] + msg = '{0:>7.0f}{1}'.format(value, unit) ret.append(self.curse_add_line( msg, self.get_views(item=i[self.get_key()], key='value', -- cgit v1.2.3 From c592bd46f602b2300becf7de57739a0e65b8c3ac Mon Sep 17 00:00:00 2001 From: Alessio Sergi Date: Sun, 18 Oct 2015 12:00:00 +0200 Subject: Restore system path after using it (v2) Already added with commit https://github.com/nicolargo/glances/commit/6bef4843be1c2e3c33441d5395524ceb192dd950. Restore and update it with export modules support. --- glances/core/glances_globals.py | 9 +++----- glances/core/glances_stats.py | 49 ++++++++++++++++++----------------------- 2 files changed, 25 insertions(+), 33 deletions(-) diff --git a/glances/core/glances_globals.py b/glances/core/glances_globals.py index 5aee9904..ff2085f4 100644 --- a/glances/core/glances_globals.py +++ b/glances/core/glances_globals.py @@ -43,12 +43,9 @@ work_path = os.path.realpath(os.path.dirname(__file__)) appname_path = os.path.split(sys.argv[0])[0] sys_prefix = os.path.realpath(os.path.dirname(appname_path)) -# Set the plugins path +# Set the plugins and export modules path plugins_path = os.path.realpath(os.path.join(work_path, '..', 'plugins')) - -# Set the export module path exports_path = os.path.realpath(os.path.join(work_path, '..', 'exports')) - sys_path = sys.path[:] -sys.path.insert(1, plugins_path) -sys.path.insert(1, exports_path) +sys.path.insert(0, exports_path) +sys.path.insert(0, plugins_path) diff --git a/glances/core/glances_stats.py b/glances/core/glances_stats.py index 9372723a..3db1097b 100644 --- a/glances/core/glances_stats.py +++ b/glances/core/glances_stats.py @@ -49,15 +49,8 @@ class GlancesStats(object): # Set the config instance self.config = config - # Init the plugin list dict - self._plugins = collections.defaultdict(dict) - # Load the plugins - self.load_plugins(args=args) - - # Init the export modules list dict - self._exports = collections.defaultdict(dict) - # Load the plugins - self.load_exports(args=args) + # Load plugins and export modules + self.load_plugins_and_exports(self.args) # Load the limits self.load_limits(config) @@ -84,6 +77,21 @@ class GlancesStats(object): # Default behavior raise AttributeError(item) + def load_plugins_and_exports(self, args): + """Wrapper to load both plugins and export modules.""" + # Init the plugins dict + self._plugins = collections.defaultdict(dict) + # Load the plugins + self.load_plugins(args=args) + + # Init the export modules dict + self._exports = collections.defaultdict(dict) + # Load the export modules + self.load_exports(args=args) + + # Restoring system path + sys.path = sys_path + def load_plugins(self, args=None): """Load all plugins in the 'plugins' folder.""" header = "glances_" @@ -106,7 +114,7 @@ class GlancesStats(object): logger.debug("Available plugins list: {0}".format(self.getAllPlugins())) def load_exports(self, args=None): - """Load all exports module in the 'exports' folder.""" + """Load all export modules in the 'exports' folder.""" if args is None: return False header = "glances_" @@ -283,19 +291,14 @@ class GlancesStatsClient(GlancesStats): def __init__(self, config=None, args=None): """Init the GlancesStatsClient class.""" - # Init the plugin list dict - self._plugins = collections.defaultdict(dict) - # Init the configuration self.config = config # Init the arguments self.args = args - # Init the export modules list dict - self._exports = collections.defaultdict(dict) - # Load the plugins - self.load_exports(args=args) + # Load plugins and exports + self.load_plugins_and_exports(self.args) def set_plugins(self, input_plugins): """Set the plugin list according to the Glances server.""" @@ -327,9 +330,6 @@ class GlancesStatsClientSNMP(GlancesStats): """This class stores, updates and gives stats for the SNMP client.""" def __init__(self, config=None, args=None): - # Init the plugin list dict - self._plugins = collections.defaultdict(dict) - # Init the configuration self.config = config @@ -339,13 +339,8 @@ class GlancesStatsClientSNMP(GlancesStats): # OS name is used because OID is differents between system self.os_name = None - # Load plugins - self.load_plugins(args=self.args) - - # Init the export modules list dict - self._exports = collections.defaultdict(dict) - # Load the plugins - self.load_exports(args=args) + # Load plugins and export modules + self.load_plugins_and_exports(self.args) def check_snmp(self): """Chek if SNMP is available on the server.""" -- cgit v1.2.3 From 39ad469c64ba21a832efa72e6afc961de82da264 Mon Sep 17 00:00:00 2001 From: Floran Brutel Date: Mon, 19 Oct 2015 20:43:08 +0200 Subject: WebUI : add "pointer" cursor for sortable column --- glances/outputs/static/css/style.css | 3 +++ glances/outputs/static/js/directives.js | 2 ++ 2 files changed, 5 insertions(+) diff --git a/glances/outputs/static/css/style.css b/glances/outputs/static/css/style.css index 084a5dd0..cf253470 100644 --- a/glances/outputs/static/css/style.css +++ b/glances/outputs/static/css/style.css @@ -36,6 +36,9 @@ body { font-weight: bold; color: white; } +.sortable { + cursor: pointer; +} .text-right { text-align: right; } diff --git a/glances/outputs/static/js/directives.js b/glances/outputs/static/js/directives.js index b45ccab1..8bdc893e 100644 --- a/glances/outputs/static/js/directives.js +++ b/glances/outputs/static/js/directives.js @@ -6,6 +6,8 @@ glancesApp.directive("sortableTh", function() { }, link: function (scope, element, attrs) { + element.addClass('sortable'); + scope.$watch(function() { return scope.sorter.column; }, function(newValue, oldValue) { -- cgit v1.2.3 From d194f2d84ccb9c59098d6483e2f63924446db080 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Mon, 19 Oct 2015 22:08:17 +0200 Subject: Change the news file --- NEWS | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 61e1f2a1..baefadd4 100644 --- a/NEWS +++ b/NEWS @@ -5,7 +5,9 @@ Glances Version 2 Version 2.x ============= - * ... +Enhancements and new features: + + * [WebUI] add "pointer" cursor for sortable columns (issue #704 from @notFloran) Version 2.5.1 ============= -- cgit v1.2.3 From 40ffbccba0e8330be59b84adc3e87e64d306b36e Mon Sep 17 00:00:00 2001 From: Nicolas Hart Date: Tue, 20 Oct 2015 11:37:47 +0200 Subject: Fix processlist IO cells not displayed --- glances/outputs/static/html/plugins/processlist.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glances/outputs/static/html/plugins/processlist.html b/glances/outputs/static/html/plugins/processlist.html index 239bacbe..81b300bc 100644 --- a/glances/outputs/static/html/plugins/processlist.html +++ b/glances/outputs/static/html/plugins/processlist.html @@ -25,8 +25,8 @@ - - + +
{{process.name}}
{{process.cmdline}}
-- cgit v1.2.3 From e13e37fd685ea6793df5102a304a0d1be764a366 Mon Sep 17 00:00:00 2001 From: Nicolas Hart Date: Tue, 20 Oct 2015 16:04:56 +0200 Subject: fix no nice decoration in webui processlist --- glances/outputs/static/js/services/plugins/glances_processlist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glances/outputs/static/js/services/plugins/glances_processlist.js b/glances/outputs/static/js/services/plugins/glances_processlist.js index 701bc996..0d459262 100644 --- a/glances/outputs/static/js/services/plugins/glances_processlist.js +++ b/glances/outputs/static/js/services/plugins/glances_processlist.js @@ -34,7 +34,7 @@ glancesApp.service('GlancesPluginProcessList', function($filter, GlancesPlugin) } } - process.isNice = process.nice !== undefined && ((data['system'].os_name === 'Windows' && nice != 32) || (!data['system'].os_name === 'Windows' && process.nice != 0)); + process.isNice = process.nice !== undefined && ((data['system'].os_name === 'Windows' && nice != 32) || (data['system'].os_name !== 'Windows' && process.nice != 0)); this.processes.push(process); } -- cgit v1.2.3 From f6930fba5c41502856898e658651e9a939c13126 Mon Sep 17 00:00:00 2001 From: Floran Brutel Date: Wed, 21 Oct 2015 19:48:30 +0200 Subject: WebUI : fix process count for stopped --- .../outputs/static/js/services/plugins/glances_processcount.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/glances/outputs/static/js/services/plugins/glances_processcount.js b/glances/outputs/static/js/services/plugins/glances_processcount.js index 3f5bb78c..163f6b49 100644 --- a/glances/outputs/static/js/services/plugins/glances_processcount.js +++ b/glances/outputs/static/js/services/plugins/glances_processcount.js @@ -10,10 +10,10 @@ glancesApp.service('GlancesPluginProcessCount', function() { this.setData = function(data, views) { data = data[_pluginName]; - this.total = data['total']; - this.running = data['running']; - this.sleeping = data['sleeping']; - this.stopped = data['stopped']; - this.thread = data['thread']; + this.total = data['total'] || 0; + this.running = data['running'] || 0; + this.sleeping = data['sleeping'] || 0; + this.stopped = data['stopped'] || 0; + this.thread = data['thread'] || 0; }; }); -- cgit v1.2.3 From 7154717c72f62ea0b2aa91814b68ba5225b38e82 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Thu, 22 Oct 2015 21:46:33 +0200 Subject: Update process sum --- glances/plugins/glances_processlist.py | 100 +++++++++++++++++++++++++++------ 1 file changed, 82 insertions(+), 18 deletions(-) diff --git a/glances/plugins/glances_processlist.py b/glances/plugins/glances_processlist.py index f619de6d..e2ed9afb 100644 --- a/glances/plugins/glances_processlist.py +++ b/glances/plugins/glances_processlist.py @@ -422,6 +422,8 @@ class Plugin(GlancesPlugin): first = False if glances_processes.process_filter is not None: self.__msg_curse_sum(ret, args=args) + self.__msg_curse_sum(ret, mmm='min', args=args) + self.__msg_curse_sum(ret, mmm='max', args=args) # Return the message with decoration return ret @@ -462,27 +464,38 @@ class Plugin(GlancesPlugin): msg = ' {0:8}'.format('Command') ret.append(self.curse_add_line(msg, sort_style if process_sort_key == 'name' else 'DEFAULT')) - def __msg_curse_sum(self, ret, sep_char='_', args=None): + def __msg_curse_sum(self, ret, sep_char='_', mmm=None, args=None): """ Build the sum message (only when filter is on) and add it to the ret dict + * ret: list of string where the message is added + * sep_char: define the line separation char + * mmm: display min, max, mean or current (if mmm=None) + * args: Glances args """ ret.append(self.curse_new_line()) - ret.append(self.curse_add_line(sep_char * 70)) - ret.append(self.curse_new_line()) + if mmm is None: + ret.append(self.curse_add_line(sep_char * 69)) + ret.append(self.curse_new_line()) # CPU percent sum - msg = '{0:>6.1f}'.format(self.__sum_stats('cpu_percent')) - ret.append(self.curse_add_line(msg, decoration='FILTER')) + msg = '{0:>6.1f}'.format(self.__sum_stats('cpu_percent', mmm=mmm)) + ret.append(self.curse_add_line(msg, + decoration=self.__mmm_deco(mmm))) # MEM percent sum - msg = '{0:>6.1f}'.format(self.__sum_stats('memory_percent')) - ret.append(self.curse_add_line(msg, decoration='FILTER')) + msg = '{0:>6.1f}'.format(self.__sum_stats('memory_percent', mmm=mmm)) + ret.append(self.curse_add_line(msg, + decoration=self.__mmm_deco(mmm))) # VIRT and RES memory sum if 'memory_info' in self.stats[0] and self.stats[0]['memory_info'] is not None and self.stats[0]['memory_info'] != '': # VMS - msg = '{0:>6}'.format(self.auto_unit(self.__sum_stats('memory_info', 1), low_precision=False)) - ret.append(self.curse_add_line(msg, decoration='FILTER', optional=True)) + msg = '{0:>6}'.format(self.auto_unit(self.__sum_stats('memory_info', indice=1, mmm=mmm), low_precision=False)) + ret.append(self.curse_add_line(msg, + decoration=self.__mmm_deco(mmm), + optional=True)) # RSS - msg = '{0:>6}'.format(self.auto_unit(self.__sum_stats('memory_info', 0), low_precision=False)) - ret.append(self.curse_add_line(msg, decoration='FILTER', optional=True)) + msg = '{0:>6}'.format(self.auto_unit(self.__sum_stats('memory_info', indice=0, mmm=mmm), low_precision=False)) + ret.append(self.curse_add_line(msg, + decoration=self.__mmm_deco(mmm), + optional=True)) else: msg = '{0:>6}'.format('') ret.append(self.curse_add_line(msg)) @@ -503,37 +516,88 @@ class Plugin(GlancesPlugin): msg = '{0:>10}'.format('') ret.append(self.curse_add_line(msg, optional=True)) # IO read/write - if 'io_counters' in self.stats[0]: + if 'io_counters' in self.stats[0] and mmm is None: # IO read - io_rs = int((self.__sum_stats('io_counters', 0) - self.__sum_stats('io_counters', 2)) / self.stats[0]['time_since_update']) + io_rs = int((self.__sum_stats('io_counters', 0) - self.__sum_stats('io_counters', indice=2, mmm=mmm)) / self.stats[0]['time_since_update']) if io_rs == 0: msg = '{0:>6}'.format('0') else: msg = '{0:>6}'.format(self.auto_unit(io_rs, low_precision=True)) - ret.append(self.curse_add_line(msg, decoration='FILTER', optional=True, additional=True)) + ret.append(self.curse_add_line(msg, + decoration=self.__mmm_deco(mmm), + optional=True, additional=True)) # IO write - io_ws = int((self.__sum_stats('io_counters', 1) - self.__sum_stats('io_counters', 3)) / self.stats[0]['time_since_update']) + io_ws = int((self.__sum_stats('io_counters', 1) - self.__sum_stats('io_counters', indice=3, mmm=mmm)) / self.stats[0]['time_since_update']) if io_ws == 0: msg = '{0:>6}'.format('0') else: msg = '{0:>6}'.format(self.auto_unit(io_ws, low_precision=True)) - ret.append(self.curse_add_line(msg, decoration='FILTER', optional=True, additional=True)) + ret.append(self.curse_add_line(msg, + decoration=self.__mmm_deco(mmm), + optional=True, additional=True)) else: msg = '{0:>6}'.format('') ret.append(self.curse_add_line(msg, optional=True, additional=True)) ret.append(self.curse_add_line(msg, optional=True, additional=True)) + if mmm is None: + msg = ' < {0:8}'.format('current') + ret.append(self.curse_add_line(msg, optional=True)) + else: + msg = ' < {0:8}'.format(mmm) + ret.append(self.curse_add_line(msg, optional=True)) + + def __mmm_deco(self, mmm): + """ + Return the decoration string for the current mmm status + """ + if mmm is not None: + return 'DEFAULT' + else: + return 'FILTER' - def __sum_stats(self, key, indice=None): + def __sum_stats(self, key, indice=None, mmm=None): """ Return the sum of the stats value for the given key - If indice is given, get the p[key][indice] + * indice: If indice is set, get the p[key][indice] + * mmm: display min, max, mean or current (if mmm=None) """ + # Compute stats summary ret = 0 for p in self.stats: if indice is None: ret += p[key] else: ret += p[key][indice] + + # Manage Min/Max/Mean + mmm_key = self.__mmm_key(key, indice) + if mmm == 'min': + try: + if self.mmm_min[mmm_key] > ret: + self.mmm_min[mmm_key] = ret + except AttributeError: + self.mmm_min = {} + return 0 + except KeyError: + self.mmm_min[mmm_key] = ret + ret = self.mmm_min[mmm_key] + elif mmm == 'max': + try: + if self.mmm_max[mmm_key] < ret: + self.mmm_max[mmm_key] = ret + except AttributeError: + self.mmm_max = {} + return 0 + except KeyError: + self.mmm_max[mmm_key] = ret + ret = self.mmm_max[mmm_key] + + return ret + + def __mmm_key(self, key, indice): + ret = key + if indice is not None: + ret += str(indice) return ret def sort_stats(self, sortedby=None): -- cgit v1.2.3 From b70e916cc7af47adeff8306c1ca5c58bb1c726ce Mon Sep 17 00:00:00 2001 From: nicolargo Date: Thu, 22 Oct 2015 22:16:29 +0200 Subject: Add reset key for process summary min/max --- NEWS | 3 ++- docs/glances-doc.rst | 4 ++++ glances/outputs/glances_curses.py | 6 ++++++ glances/plugins/glances_processlist.py | 16 ++++++++++++++-- man/glances.1 | 6 ++++++ 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index baefadd4..f3140848 100644 --- a/NEWS +++ b/NEWS @@ -7,7 +7,8 @@ Version 2.x Enhancements and new features: - * [WebUI] add "pointer" cursor for sortable columns (issue #704 from @notFloran) + * Add process summary min/max stats (issue #703) + * [WebUI] add "pointer" cursor for sortable columns (issue #704 from @notFloran) Version 2.5.1 ============= diff --git a/docs/glances-doc.rst b/docs/glances-doc.rst index b826cee0..1f1ecb55 100644 --- a/docs/glances-doc.rst +++ b/docs/glances-doc.rst @@ -258,6 +258,8 @@ The following commands (key pressed) are supported while in Glances: Show/hide log messages ``m`` Sort processes by MEM usage +``M`` + Reset processes summary min/max ``n`` Show/hide network stats ``p`` @@ -266,6 +268,8 @@ The following commands (key pressed) are supported while in Glances: Quit the current Glances session ``r`` Reset history +``R`` + Show/Hide RAID plugins ``s`` Show/hide sensors stats ``t`` diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py index 9d998518..483d1241 100644 --- a/glances/outputs/glances_curses.py +++ b/glances/outputs/glances_curses.py @@ -85,6 +85,9 @@ class _GlancesCurses(object): # Init edit filter tag self.edit_filter = False + # Init the process min/max reset + self.args.reset_minmax_tag = False + # Catch key pressed with non blocking mode self.no_flash_cursor() self.term_window.nodelay(1) @@ -350,6 +353,9 @@ class _GlancesCurses(object): # 'm' > Sort processes by MEM usage glances_processes.auto_sort = False glances_processes.sort_key = 'memory_percent' + elif self.pressedkey == ord('M'): + # 'M' > Reset processes summary min/max + self.args.reset_minmax_tag = not self.args.reset_minmax_tag elif self.pressedkey == ord('n'): # 'n' > Show/hide network stats self.args.disable_network = not self.args.disable_network diff --git a/glances/plugins/glances_processlist.py b/glances/plugins/glances_processlist.py index e2ed9afb..b8717630 100644 --- a/glances/plugins/glances_processlist.py +++ b/glances/plugins/glances_processlist.py @@ -421,6 +421,9 @@ class Plugin(GlancesPlugin): # End of extended stats first = False if glances_processes.process_filter is not None: + if args.reset_minmax_tag: + args.reset_minmax_tag = not args.reset_minmax_tag + self.__mmm_reset() self.__msg_curse_sum(ret, args=args) self.__msg_curse_sum(ret, mmm='min', args=args) self.__msg_curse_sum(ret, mmm='max', args=args) @@ -540,10 +543,12 @@ class Plugin(GlancesPlugin): ret.append(self.curse_add_line(msg, optional=True, additional=True)) ret.append(self.curse_add_line(msg, optional=True, additional=True)) if mmm is None: - msg = ' < {0:8}'.format('current') + msg = ' < {0}'.format('current') ret.append(self.curse_add_line(msg, optional=True)) else: - msg = ' < {0:8}'.format(mmm) + msg = ' < {0}'.format(mmm) + ret.append(self.curse_add_line(msg, optional=True)) + msg = ' (\'M\' to reset)' ret.append(self.curse_add_line(msg, optional=True)) def __mmm_deco(self, mmm): @@ -555,6 +560,13 @@ class Plugin(GlancesPlugin): else: return 'FILTER' + def __mmm_reset(self): + """ + Reset the MMM stats + """ + self.mmm_min = {} + self.mmm_max = {} + def __sum_stats(self, key, indice=None, mmm=None): """ Return the sum of the stats value for the given key diff --git a/man/glances.1 b/man/glances.1 index eeeab5fb..5cbb4243 100644 --- a/man/glances.1 +++ b/man/glances.1 @@ -228,6 +228,9 @@ Show/hide log messages .B m Sort processes by MEM usage .TP +.B M +Reset processes summary min/max +.TP .B n Show/hide network stats .TP @@ -240,6 +243,9 @@ Quit .B r Reset history .TP +.B R +Disable/enable RAID plugins +.TP .B s Show/hide sensors stats .TP -- cgit v1.2.3 From 458b10800ab21d71f48e7665812675bba931319b Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sun, 25 Oct 2015 21:56:12 +0100 Subject: Add timestamp to the CSV export module (issue #708) --- NEWS | 1 + glances/exports/glances_csv.py | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index f3140848..c1d0af4d 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ Version 2.x Enhancements and new features: * Add process summary min/max stats (issue #703) + * Add timestamp to the CSV export module (issue #708) * [WebUI] add "pointer" cursor for sortable columns (issue #704 from @notFloran) Version 2.5.1 diff --git a/glances/exports/glances_csv.py b/glances/exports/glances_csv.py index 0d23f252..bac46e94 100644 --- a/glances/exports/glances_csv.py +++ b/glances/exports/glances_csv.py @@ -22,6 +22,7 @@ # Import sys libs import csv import sys +import time # Import Glances lib from glances.core.glances_globals import is_py3 @@ -64,13 +65,14 @@ class Export(GlancesExport): def update(self, stats): """Update stats in the CSV output file.""" - csv_header = [] - csv_data = [] - # Get the stats all_stats = stats.getAllExports() plugins = stats.getAllPlugins() + # Init data with timestamp (issue#708) + csv_header = ['timestamp'] + csv_data = [time.strftime('%Y-%m-%d %H:%M:%S')] + # Loop over available plugin for i, plugin in enumerate(plugins): if plugin in self.plugins_to_export(): -- cgit v1.2.3 From 2448c0414576de5d5844e636fb940cbdcd4579b4 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Thu, 29 Oct 2015 18:15:50 +0100 Subject: Correct Grafana dashboard following https://github.com/nicolargo/glances/issues/648#issuecomment-152184064 comment --- conf/glances-grafana.json | 58 +++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/conf/glances-grafana.json b/conf/glances-grafana.json index 89152238..9b6c4870 100644 --- a/conf/glances-grafana.json +++ b/conf/glances-grafana.json @@ -30,7 +30,7 @@ "function": "mean", "column": "cpucore", "series": "load", - "query": "select mean(cpucore) from \"load\" where $timeFilter group by time($interval) order asc" + "query": "select mean(cpucore) from \"load\" where $timeFilter group by time($interval) order by asc" } ], "cacheTimeout": null, @@ -128,7 +128,7 @@ "function": "mean", "column": "min1", "series": "load", - "query": "select mean(min1) from \"load\" where $timeFilter group by time($interval) fill(null) order asc", + "query": "select mean(min1) from \"load\" where $timeFilter group by time($interval) fill(null) order by asc", "alias": "1min", "fill": "null" }, @@ -137,7 +137,7 @@ "function": "mean", "column": "min5", "series": "load", - "query": "select mean(min5) from \"load\" where $timeFilter group by time($interval) fill(null) order asc", + "query": "select mean(min5) from \"load\" where $timeFilter group by time($interval) fill(null) order by asc", "alias": "5mins", "fill": "null" }, @@ -146,7 +146,7 @@ "function": "mean", "column": "min15", "series": "load", - "query": "select mean(min15) from \"load\" where $timeFilter group by time($interval) fill(null) order asc", + "query": "select mean(min15) from \"load\" where $timeFilter group by time($interval) fill(null) order by asc", "fill": "null", "alias": "15mins" } @@ -177,7 +177,7 @@ "function": "mean", "column": "total", "series": "processcount", - "query": "select mean(total) from \"processcount\" where $timeFilter group by time($interval) order asc" + "query": "select mean(total) from \"processcount\" where $timeFilter group by time($interval) order by asc" } ], "cacheTimeout": null, @@ -274,7 +274,7 @@ "function": "mean", "column": "user", "series": "cpu", - "query": "select mean(user) from \"cpu\" where $timeFilter group by time($interval) fill(null) order asc", + "query": "select mean(user) from \"cpu\" where $timeFilter group by time($interval) fill(null) order by asc", "alias": "User", "fill": "null" }, @@ -283,7 +283,7 @@ "function": "mean", "column": "system", "series": "cpu", - "query": "select mean(system) from \"cpu\" where $timeFilter group by time($interval) fill(null) order asc", + "query": "select mean(system) from \"cpu\" where $timeFilter group by time($interval) fill(null) order by asc", "alias": "System", "fill": "null" }, @@ -292,7 +292,7 @@ "function": "mean", "column": "iowait", "series": "cpu", - "query": "select mean(iowait) from \"cpu\" where $timeFilter group by time($interval) fill(null) order asc", + "query": "select mean(iowait) from \"cpu\" where $timeFilter group by time($interval) fill(null) order by asc", "alias": "IoWait", "fill": "null" } @@ -354,7 +354,7 @@ "function": "mean", "column": "used", "series": "mem", - "query": "select mean(used) from \"mem\" where $timeFilter group by time($interval) order asc", + "query": "select mean(used) from \"mem\" where $timeFilter group by time($interval) order by asc", "alias": "Used" }, { @@ -362,7 +362,7 @@ "function": "mean", "column": "total", "series": "mem", - "query": "select mean(total) from \"mem\" where $timeFilter group by time($interval) order asc", + "query": "select mean(total) from \"mem\" where $timeFilter group by time($interval) order by asc", "alias": "Max" } ], @@ -431,7 +431,7 @@ "function": "mean", "column": "enp0s25.rx", "series": "network", - "query": "select mean(enp0s25.rx) from \"network\" where $timeFilter group by time($interval) fill(null) order asc", + "query": "select mean(enp0s25.rx) from \"network\" where $timeFilter group by time($interval) fill(null) order by asc", "alias": "Rx", "interval": "", "fill": "null" @@ -441,7 +441,7 @@ "function": "mean", "column": "enp0s25.tx*-1", "series": "network", - "query": "select mean(enp0s25.tx*-1) from \"network\" where $timeFilter group by time($interval) fill(null) order asc", + "query": "select mean(enp0s25.tx*-1) from \"network\" where $timeFilter group by time($interval) fill(null) order by asc", "alias": "Tx", "fill": "null" } @@ -503,7 +503,7 @@ "function": "mean", "column": "used", "series": "memswap", - "query": "select mean(used) from \"memswap\" where $timeFilter group by time($interval) order asc", + "query": "select mean(used) from \"memswap\" where $timeFilter group by time($interval) order by asc", "alias": "Used" }, { @@ -511,7 +511,7 @@ "function": "mean", "column": "total", "series": "memswap", - "query": "select mean(total) from \"memswap\" where $timeFilter group by time($interval) order asc", + "query": "select mean(total) from \"memswap\" where $timeFilter group by time($interval) order by asc", "alias": "Max" } ], @@ -580,7 +580,7 @@ "function": "mean", "column": "sda2.read_bytes", "series": "diskio", - "query": "select mean(sda2.read_bytes) from \"diskio\" where $timeFilter group by time($interval) fill(null) order asc", + "query": "select mean(sda2.read_bytes) from \"diskio\" where $timeFilter group by time($interval) fill(null) order by asc", "alias": "Read", "fill": "null" }, @@ -589,7 +589,7 @@ "function": "mean", "column": "sda2.write_bytes", "series": "diskio", - "query": "select mean(sda2.write_bytes) from \"diskio\" where $timeFilter group by time($interval) fill(null) order asc", + "query": "select mean(sda2.write_bytes) from \"diskio\" where $timeFilter group by time($interval) fill(null) order by asc", "alias": "Write", "fill": "null" } @@ -651,7 +651,7 @@ "function": "mean", "column": "\"/.used\"", "series": "fs", - "query": "select mean(\"/.used\") from \"fs\" where $timeFilter group by time($interval) fill(null) order asc", + "query": "select mean(\"/.used\") from \"fs\" where $timeFilter group by time($interval) fill(null) order by asc", "alias": "Used", "fill": "null" }, @@ -660,7 +660,7 @@ "function": "mean", "column": "\"/.size\"", "series": "fs", - "query": "select mean(\"/.size\") from \"fs\" where $timeFilter group by time($interval) fill(null) order asc", + "query": "select mean(\"/.size\") from \"fs\" where $timeFilter group by time($interval) fill(null) order by asc", "alias": "Max", "fill": "null" } @@ -684,7 +684,7 @@ "function": "mean", "column": "\"/.percent\"", "series": "fs", - "query": "select mean(\"/.percent\") from \"fs\" where $timeFilter group by time($interval) order asc" + "query": "select mean(\"/.percent\") from \"fs\" where $timeFilter group by time($interval) order by asc" } ], "cacheTimeout": null, @@ -734,7 +734,7 @@ "function": "mean", "column": "\"/home.percent\"", "series": "fs", - "query": "select mean(\"/home.percent\") from \"fs\" where $timeFilter group by time($interval) order asc" + "query": "select mean(\"/home.percent\") from \"fs\" where $timeFilter group by time($interval) order by asc" } ], "cacheTimeout": null, @@ -850,7 +850,7 @@ "function": "mean", "column": "user", "series": "cpu", - "query": "select mean(user) from \"cpu\" where $timeFilter group by time($interval) order asc", + "query": "select mean(user) from \"cpu\" where $timeFilter group by time($interval) order by asc", "interval": "60s", "alias": "mean" }, @@ -859,7 +859,7 @@ "function": "min", "column": "user", "series": "cpu", - "query": "select min(user) from \"cpu\" where $timeFilter group by time($interval) order asc", + "query": "select min(user) from \"cpu\" where $timeFilter group by time($interval) order by asc", "interval": "60s", "alias": "min" }, @@ -868,7 +868,7 @@ "function": "max", "column": "user", "series": "cpu", - "query": "select max(user) from \"cpu\" where $timeFilter group by time($interval) order asc", + "query": "select max(user) from \"cpu\" where $timeFilter group by time($interval) order by asc", "interval": "60s", "alias": "max" } @@ -947,7 +947,7 @@ "function": "mean", "column": "system", "series": "cpu", - "query": "select mean(system) from \"cpu\" where $timeFilter group by time($interval) order asc", + "query": "select mean(system) from \"cpu\" where $timeFilter group by time($interval) order by asc", "interval": "60s", "alias": "mean" }, @@ -956,7 +956,7 @@ "function": "min", "column": "system", "series": "cpu", - "query": "select min(system) from \"cpu\" where $timeFilter group by time($interval) order asc", + "query": "select min(system) from \"cpu\" where $timeFilter group by time($interval) order by asc", "interval": "60s", "alias": "min" }, @@ -965,7 +965,7 @@ "function": "max", "column": "system", "series": "cpu", - "query": "select max(system) from \"cpu\" where $timeFilter group by time($interval) order asc", + "query": "select max(system) from \"cpu\" where $timeFilter group by time($interval) order by asc", "interval": "60s", "alias": "max" } @@ -1044,7 +1044,7 @@ "function": "mean", "column": "iowait", "series": "cpu", - "query": "select mean(iowait) from \"cpu\" where $timeFilter group by time($interval) order asc", + "query": "select mean(iowait) from \"cpu\" where $timeFilter group by time($interval) order by asc", "interval": "60s", "alias": "mean" }, @@ -1053,7 +1053,7 @@ "function": "min", "column": "iowait", "series": "cpu", - "query": "select min(iowait) from \"cpu\" where $timeFilter group by time($interval) order asc", + "query": "select min(iowait) from \"cpu\" where $timeFilter group by time($interval) order by asc", "interval": "60s", "alias": "min" }, @@ -1062,7 +1062,7 @@ "function": "max", "column": "iowait", "series": "cpu", - "query": "select max(iowait) from \"cpu\" where $timeFilter group by time($interval) order asc", + "query": "select max(iowait) from \"cpu\" where $timeFilter group by time($interval) order by asc", "interval": "60s", "alias": "max" } -- cgit v1.2.3 From ef6bd55c90a4229dbf818806bb4055bfb7b6e685 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Thu, 29 Oct 2015 19:02:56 +0100 Subject: Update Grafana Dashboard for Grafana 2.5 and InfluxDB 0.9.4 --- conf/glances-grafana.json | 1899 ++++++++++++++++++++++++++++----------------- 1 file changed, 1188 insertions(+), 711 deletions(-) diff --git a/conf/glances-grafana.json b/conf/glances-grafana.json index 9b6c4870..cc1d8312 100644 --- a/conf/glances-grafana.json +++ b/conf/glances-grafana.json @@ -10,701 +10,1031 @@ "sharedCrosshair": false, "rows": [ { - "title": "test", - "height": "250px", - "editable": true, "collapse": false, + "editable": true, + "height": "250px", "panels": [ { - "title": "Core", - "error": false, - "span": 1, + "cacheTimeout": null, + "colorBackground": false, + "colorValue": false, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "datasource": "glances", "editable": true, - "type": "singlestat", + "error": false, + "format": "none", "id": 5, + "interval": null, "links": [], "maxDataPoints": 100, - "interval": null, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "span": 1, + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": false + }, "targets": [ { - "function": "mean", "column": "cpucore", + "function": "mean", + "query": "SELECT mean(\"cpucore\") AS \"cpucore\" FROM \"load\" WHERE $timeFilter GROUP BY time($interval)", + "refId": "A", "series": "load", - "query": "select mean(cpucore) from \"load\" where $timeFilter group by time($interval) order by asc" + "tags": [], + "groupBy": [ + { + "type": "time", + "interval": "auto" + } + ], + "fields": [ + { + "name": "cpucore", + "func": "mean" + } + ], + "measurement": "load" } ], - "cacheTimeout": null, - "format": "none", - "prefix": "", - "postfix": "", - "nullText": null, + "thresholds": "", + "title": "Core", + "type": "singlestat", + "valueFontSize": "80%", "valueMaps": [ { - "value": "null", "op": "=", - "text": "N/A" + "text": "N/A", + "value": "null" } ], - "nullPointMode": "connected", - "valueName": "avg", - "prefixFontSize": "50%", - "valueFontSize": "80%", - "postfixFontSize": "50%", - "thresholds": "", - "colorBackground": false, - "colorValue": false, - "colors": [ - "rgba(245, 54, 54, 0.9)", - "rgba(237, 129, 40, 0.89)", - "rgba(50, 172, 45, 0.97)" - ], - "sparkline": { - "show": false, - "full": false, - "lineColor": "rgb(31, 120, 193)", - "fillColor": "rgba(31, 118, 189, 0.18)" - }, - "datasource": "glances" + "valueName": "avg" }, { - "id": 4, - "span": 10, - "type": "graph", - "x-axis": true, - "y-axis": true, - "scale": 1, - "y_formats": [ - "short", - "short" - ], + "aliasColors": {}, + "aliasYAxis": {}, + "annotate": { + "enable": false + }, + "bars": false, + "datasource": "glances", + "fill": 1, "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, "max": null, "min": null, - "leftMax": null, + "rightLogBase": 1, "rightMax": null, - "leftMin": null, "rightMin": null, "threshold1": null, - "threshold2": null, "threshold1Color": "rgba(216, 200, 27, 0.27)", + "threshold2": null, "threshold2Color": "rgba(234, 112, 112, 0.22)", "thresholdLine": false }, - "resolution": 100, - "lines": true, - "fill": 1, - "linewidth": 2, - "points": false, - "pointradius": 5, - "bars": false, - "stack": true, - "spyable": true, - "options": false, + "id": 4, + "interactive": true, "legend": { - "show": true, - "values": true, - "min": true, - "max": true, - "current": false, - "total": false, + "alignAsTable": false, "avg": true, + "current": false, + "max": true, + "min": true, "rightSide": false, - "alignAsTable": false + "show": true, + "total": false, + "values": true }, - "interactive": true, "legend_counts": true, - "timezone": "browser", - "percentage": false, + "lines": true, + "linewidth": 2, + "links": [], "nullPointMode": "connected", + "options": false, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "resolution": 100, + "scale": 1, + "seriesOverrides": [], + "span": 10, + "spyable": true, + "stack": true, "steppedLine": false, - "tooltip": { - "value_type": "cumulative", - "query_as_alias": true, - "shared": false - }, "targets": [ { - "target": "randomWalk('random walk')", - "function": "mean", + "alias": "1min", "column": "min1", + "fill": "null", + "function": "mean", + "query": "SELECT mean(\"min1\") AS \"min1\" FROM \"load\" WHERE $timeFilter GROUP BY time($interval) fill(null)", + "refId": "A", "series": "load", - "query": "select mean(min1) from \"load\" where $timeFilter group by time($interval) fill(null) order by asc", - "alias": "1min", - "fill": "null" + "target": "randomWalk('random walk')", + "tags": [], + "groupBy": [ + { + "type": "time", + "interval": "auto" + } + ], + "fields": [ + { + "name": "min1", + "func": "mean" + } + ], + "measurement": "load" }, { - "target": "", - "function": "mean