mirror of
https://github.com/nicolargo/glances.git
synced 2026-03-13 19:39:08 -04:00
Alert < 3 seconds are no longer displayed
This commit is contained in:
4
NEWS
4
NEWS
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user