Correct bug on the monitored interface

pull/354/head
Nicolas Hennion 2014-03-28 15:10:53 +01:00
parent f811fb84ff
commit 825573a210
2 changed files with 6 additions and 10 deletions

View File

@ -125,22 +125,19 @@ class monitorList:
# Iter uppon the monitored list
for i in range(0, len(self.get())):
if (self.command(i) is None):
# If there is no command specified in the conf file
# then display CPU and MEM %
# Search monitored processes by a regular expression
processlist = glances_processes.getlist()
monitoredlist = [p for p in processlist if re.search(self.regex(i), p['cmdline']) is not None]
self.__monitor_list[i]['count'] = len(monitoredlist)
if (self.command(i) is None):
# If there is no command specified in the conf file
# then display CPU and MEM %
self.__monitor_list[i]['result'] = "CPU: {0:.1f}% | MEM: {1:.1f}%".format(
sum([p['cpu_percent'] for p in monitoredlist]),
sum([p['memory_percent'] for p in monitoredlist]))
continue
else:
# No process to count
self.__monitor_list[i]['count'] = 1
# Execute the user command line
try:
self.__monitor_list[i]['result'] = subprocess.check_output(self.command(i),

View File

@ -53,8 +53,7 @@ class Plugin(GlancesPlugin):
def update(self):
"""
Nothing to do here
Just return the global glances_log
Update the monitored list
"""
# Check if the glances_monitor instance is init
if (self.glances_monitors == None):