From 389423337581553edffcd9cdd0e6b2868b70765e Mon Sep 17 00:00:00 2001 From: nicolargo Date: Fri, 15 Apr 2016 16:10:24 +0200 Subject: [PATCH] Regression corrected --- glances/amps_list.py | 9 ++++++--- glances/monitor_list.py | 2 +- glances/outputs/glances_curses.py | 6 +++--- glances/plugins/glances_amps.py | 4 ++-- glances/plugins/glances_monitor.py | 2 ++ glances/processes.py | 2 +- 6 files changed, 15 insertions(+), 10 deletions(-) diff --git a/glances/amps_list.py b/glances/amps_list.py index 089202bc..371d19e2 100644 --- a/glances/amps_list.py +++ b/glances/amps_list.py @@ -31,7 +31,7 @@ from glances.processes import glances_processes class AmpsList(object): - """This class describes the optional application process monitoring list. + """This class describes the optional application monitoring process list. The AMP list is a list of processes with a specific monitoring action. @@ -91,11 +91,14 @@ class AmpsList(object): def update(self): """Update the command result attributed.""" # Search application monitored processes by a regular expression - processlist = [p for p in glances_processes.getalllist()] + processlist = glances_processes.getalllist() # Iter upon the AMPs dict for k, v in iteritems(self.get()): - amps_list = [p for p in processlist for c in p['cmdline'] if re.search(v.regex(), c) is not None] + try: + amps_list = [p for p in processlist for c in p['cmdline'] if re.search(v.regex(), c) is not None] + except TypeError: + continue if len(amps_list) > 0: # At least one process is matching the regex logger.debug("AMPS: {} process detected (PID={})".format(k, amps_list[0]['pid'])) diff --git a/glances/monitor_list.py b/glances/monitor_list.py index 4243b630..ad8e3c43 100644 --- a/glances/monitor_list.py +++ b/glances/monitor_list.py @@ -124,7 +124,7 @@ class MonitorList(object): return self.__monitor_list # Search monitored processes by a regular expression - processlist = [p for p in glances_processes.getalllist()] + processlist = glances_processes.getalllist() # Iter upon the monitored list for i in range(len(self.get())): diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py index a02a409e..d04818f8 100644 --- a/glances/outputs/glances_curses.py +++ b/glances/outputs/glances_curses.py @@ -723,15 +723,15 @@ class _GlancesCurses(object): self.new_column() self.new_line() self.display_plugin(stats_docker) - self.new_line() - self.display_plugin(stats_processcount) if glances_processes.process_filter is None and cs_status is None: # Do not display stats monitor list and AMPS if a filter exist self.new_line() self.display_plugin(stats_monitor) self.new_line() self.display_plugin(stats_amps) - # self.new_line() + self.new_line() + self.display_plugin(stats_processcount) + self.new_line() self.display_plugin(stats_processlist, display_optional=(screen_x > 102), display_additional=(not OSX), diff --git a/glances/plugins/glances_amps.py b/glances/plugins/glances_amps.py index 91a41396..0672621b 100644 --- a/glances/plugins/glances_amps.py +++ b/glances/plugins/glances_amps.py @@ -86,8 +86,8 @@ class Plugin(GlancesPlugin): first_column = '{0}'.format(m['key']) for l in m['result'].split('\n'): # Display first column with the process name... - msg = '{0:<16} '.format(first_column) - ret.append(self.curse_add_line(msg)) + msg = '{0:<20} '.format(first_column) + ret.append(self.curse_add_line(msg, "TITLE")) # ... only on the first line first_column = '' # Display AMP result in the second column diff --git a/glances/plugins/glances_monitor.py b/glances/plugins/glances_monitor.py index 71d25acc..98e9b698 100644 --- a/glances/plugins/glances_monitor.py +++ b/glances/plugins/glances_monitor.py @@ -21,6 +21,7 @@ from glances.compat import u from glances.monitor_list import MonitorList as glancesMonitorList +from glances.logger import logger from glances.plugins.glances_plugin import GlancesPlugin @@ -43,6 +44,7 @@ class Plugin(GlancesPlugin): """Load the monitored list from the config file, if it exists.""" self.glances_monitors = glancesMonitorList(config) + @GlancesPlugin._log_result_decorator def update(self): """Update the monitored list.""" if self.input_method == 'local': diff --git a/glances/processes.py b/glances/processes.py index 5ae81ebc..843e848f 100644 --- a/glances/processes.py +++ b/glances/processes.py @@ -511,7 +511,7 @@ class GlancesProcesses(object): first = False # Build the all processes list used by the monitored list - self.allprocesslist = itervalues(processdict) + self.allprocesslist = [p for p in itervalues(processdict)] # Clean internals caches if timeout is reached if self.cache_timer.finished():