Regression corrected

This commit is contained in:
nicolargo 2016-04-15 16:10:24 +02:00
parent 09d87e0a4e
commit 3894233375
6 changed files with 15 additions and 10 deletions

View File

@ -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()):
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']))

View File

@ -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())):

View File

@ -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),

View File

@ -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

View File

@ -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':

View File

@ -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():