mirror of
https://github.com/nicolargo/glances.git
synced 2024-11-25 08:33:22 +03:00
Regression corrected
This commit is contained in:
parent
09d87e0a4e
commit
3894233375
@ -31,7 +31,7 @@ from glances.processes import glances_processes
|
|||||||
|
|
||||||
class AmpsList(object):
|
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.
|
The AMP list is a list of processes with a specific monitoring action.
|
||||||
|
|
||||||
@ -91,11 +91,14 @@ class AmpsList(object):
|
|||||||
def update(self):
|
def update(self):
|
||||||
"""Update the command result attributed."""
|
"""Update the command result attributed."""
|
||||||
# Search application monitored processes by a regular expression
|
# 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
|
# Iter upon the AMPs dict
|
||||||
for k, v in iteritems(self.get()):
|
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:
|
if len(amps_list) > 0:
|
||||||
# At least one process is matching the regex
|
# At least one process is matching the regex
|
||||||
logger.debug("AMPS: {} process detected (PID={})".format(k, amps_list[0]['pid']))
|
logger.debug("AMPS: {} process detected (PID={})".format(k, amps_list[0]['pid']))
|
||||||
|
@ -124,7 +124,7 @@ class MonitorList(object):
|
|||||||
return self.__monitor_list
|
return self.__monitor_list
|
||||||
|
|
||||||
# Search monitored processes by a regular expression
|
# Search monitored processes by a regular expression
|
||||||
processlist = [p for p in glances_processes.getalllist()]
|
processlist = glances_processes.getalllist()
|
||||||
|
|
||||||
# Iter upon the monitored list
|
# Iter upon the monitored list
|
||||||
for i in range(len(self.get())):
|
for i in range(len(self.get())):
|
||||||
|
@ -723,15 +723,15 @@ class _GlancesCurses(object):
|
|||||||
self.new_column()
|
self.new_column()
|
||||||
self.new_line()
|
self.new_line()
|
||||||
self.display_plugin(stats_docker)
|
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:
|
if glances_processes.process_filter is None and cs_status is None:
|
||||||
# Do not display stats monitor list and AMPS if a filter exist
|
# Do not display stats monitor list and AMPS if a filter exist
|
||||||
self.new_line()
|
self.new_line()
|
||||||
self.display_plugin(stats_monitor)
|
self.display_plugin(stats_monitor)
|
||||||
self.new_line()
|
self.new_line()
|
||||||
self.display_plugin(stats_amps)
|
self.display_plugin(stats_amps)
|
||||||
# self.new_line()
|
self.new_line()
|
||||||
|
self.display_plugin(stats_processcount)
|
||||||
|
self.new_line()
|
||||||
self.display_plugin(stats_processlist,
|
self.display_plugin(stats_processlist,
|
||||||
display_optional=(screen_x > 102),
|
display_optional=(screen_x > 102),
|
||||||
display_additional=(not OSX),
|
display_additional=(not OSX),
|
||||||
|
@ -86,8 +86,8 @@ class Plugin(GlancesPlugin):
|
|||||||
first_column = '{0}'.format(m['key'])
|
first_column = '{0}'.format(m['key'])
|
||||||
for l in m['result'].split('\n'):
|
for l in m['result'].split('\n'):
|
||||||
# Display first column with the process name...
|
# Display first column with the process name...
|
||||||
msg = '{0:<16} '.format(first_column)
|
msg = '{0:<20} '.format(first_column)
|
||||||
ret.append(self.curse_add_line(msg))
|
ret.append(self.curse_add_line(msg, "TITLE"))
|
||||||
# ... only on the first line
|
# ... only on the first line
|
||||||
first_column = ''
|
first_column = ''
|
||||||
# Display AMP result in the second column
|
# Display AMP result in the second column
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
from glances.compat import u
|
from glances.compat import u
|
||||||
from glances.monitor_list import MonitorList as glancesMonitorList
|
from glances.monitor_list import MonitorList as glancesMonitorList
|
||||||
|
from glances.logger import logger
|
||||||
from glances.plugins.glances_plugin import GlancesPlugin
|
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."""
|
"""Load the monitored list from the config file, if it exists."""
|
||||||
self.glances_monitors = glancesMonitorList(config)
|
self.glances_monitors = glancesMonitorList(config)
|
||||||
|
|
||||||
|
@GlancesPlugin._log_result_decorator
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Update the monitored list."""
|
"""Update the monitored list."""
|
||||||
if self.input_method == 'local':
|
if self.input_method == 'local':
|
||||||
|
@ -511,7 +511,7 @@ class GlancesProcesses(object):
|
|||||||
first = False
|
first = False
|
||||||
|
|
||||||
# Build the all processes list used by the monitored list
|
# 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
|
# Clean internals caches if timeout is reached
|
||||||
if self.cache_timer.finished():
|
if self.cache_timer.finished():
|
||||||
|
Loading…
Reference in New Issue
Block a user