提交 8a7bebc8 编写于 作者: N Nicolargo

Alert < 3 seconds are no longer displayed

上级 f96145bf
......@@ -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
=============
......
......@@ -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
......
......@@ -153,8 +153,6 @@ class Plugin(GlancesPlugin):
# Not available
pass
logger.info(self.stats)
return self.stats
def get_docker_cpu(self, id):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册