Alert < 3 seconds are no longer displayed

This commit is contained in:
Nicolargo
2015-01-24 14:37:23 +01:00
parent f96145bf3e
commit 8a7bebc8a8
3 changed files with 15 additions and 6 deletions

4
NEWS
View File

@@ -23,6 +23,10 @@ Bugs corrected:
* R/W error with the glances.log file (issue #474)
Other enhancement:
* Alert < 3 seconds are no longer displayed
Version 2.2.1
=============

View File

@@ -100,12 +100,15 @@ class GlancesLogs(object):
return process_auto_by
def add(self, item_state, item_type, item_value, proc_list=[], proc_desc=""):
def add(self, item_state, item_type, item_value,
proc_list=[], proc_desc="",
peak_time=3):
"""Add a new item to the logs list.
If 'item' is a 'new one', add the new item at the beginning of the logs
list.
If 'item' is not a 'new one', update the existing item.
If event < peak_time the the alert is not setoff
"""
# Add or update the log
item_index = self.__itemexist__(item_type)
@@ -147,9 +150,13 @@ class GlancesLogs(object):
# Reset the automatic process sort key
self.reset_process_sort()
# Close the item
self.logs_list[item_index][1] = time.mktime(
datetime.now().timetuple())
endtime = time.mktime(datetime.now().timetuple())
if endtime - self.logs_list[item_index][0] > self.peak_time:
# If event is > peak_time seconds
self.logs_list[item_index][1] = endtime
else:
# If event <= peak_time seconds, ignore
self.logs_list.remove(self.logs_list[item_index])
else:
# Update the item
# State

View File

@@ -153,8 +153,6 @@ class Plugin(GlancesPlugin):
# Not available
pass
logger.info(self.stats)
return self.stats
def get_docker_cpu(self, id):