diff options
author | Nicolas Hennion <nicolas@nicolargo.com> | 2013-08-09 11:04:23 +0200 |
---|---|---|
committer | Nicolas Hennion <nicolas@nicolargo.com> | 2013-08-09 11:04:23 +0200 |
commit | d3c1205831af283a9b6f56b708bb3298d2096938 (patch) | |
tree | 4b7f56869adaba41be4667d25d20408234d25474 | |
parent | 9c3f219f16ab705114c9d084f839841280e1b1bf (diff) |
Enhance monitored process log message
-rw-r--r-- | glances/conf/glances-with-monitored.conf | 1 | ||||
-rw-r--r-- | glances/glances.py | 25 |
2 files changed, 23 insertions, 3 deletions
diff --git a/glances/conf/glances-with-monitored.conf b/glances/conf/glances-with-monitored.conf index c9caa71e..0431472c 100644 --- a/glances/conf/glances-with-monitored.conf +++ b/glances/conf/glances-with-monitored.conf @@ -100,3 +100,4 @@ list_2_description=Python programs list_2_regex=.*python.* list_3_description=Famous Xeyes list_3_regex=.*xeyes.* +list_3_countmax=1 diff --git a/glances/glances.py b/glances/glances.py index 7f400e4b..aecfa2a2 100644 --- a/glances/glances.py +++ b/glances/glances.py @@ -19,7 +19,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. __appname__ = 'glances' -__version__ = "1.7RC4" +__version__ = "1.7RC5" __author__ = "Nicolas Hennion <nicolas@nicolargo.com>" __licence__ = "LGPL" @@ -687,17 +687,26 @@ class glancesLogs: """ # Add Top process sort depending on alert type + sortby = 'none' if item_type.startswith("MEM"): # Sort TOP process by memory_percent sortby = 'memory_percent' elif item_type.startswith("CPU IO") and is_Linux: # Sort TOP process by io_counters (only for Linux OS) sortby = 'io_counters' + elif item_type.startswith("MON"): + # Do no sort process for monitored prcesses list + sortby = 'none' else: # Default TOP process sort is cpu_percent sortby = 'cpu_percent' - topprocess = sorted(proc_list, key=lambda process: process[sortby], - reverse=True) + + # Sort processes + if (sortby != 'none'): + topprocess = sorted(proc_list, key=lambda process: process[sortby], + reverse=True) + else: + topprocess = proc_list # Add or update the log item_index = self.__itemexist__(item_type) @@ -2977,11 +2986,21 @@ class glancesScreen: logmark = '~' logmsg += " > " + "%19s" % "___________________" if log[logcount][3][:3] == "MEM": + # Special display for MEMORY logmsg += " {0} ({1}/{2}/{3})".format( log[logcount][3], self.__autoUnit(log[logcount][6]), self.__autoUnit(log[logcount][5]), self.__autoUnit(log[logcount][4])) + elif log[logcount][3][:3] == "MON": + # Special display for monitored pocesses list + if (log[logcount][5] == 0): + logmsg += " No running process" + elif (log[logcount][5] == 1): + logmsg += " One running process" + else: + logmsg += " {0} running processes".format( + self.__autoUnit(log[logcount][5])) else: logmsg += " {0} ({1:.1f}/{2:.1f}/{3:.1f})".format( log[logcount][3], log[logcount][6], |