diff --git a/NEWS b/NEWS index 8e32b1f4..4b4419ef 100644 --- a/NEWS +++ b/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 ============= diff --git a/glances/core/glances_logs.py b/glances/core/glances_logs.py index 7d6a10b6..3e9ee33f 100644 --- a/glances/core/glances_logs.py +++ b/glances/core/glances_logs.py @@ -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 diff --git a/glances/plugins/glances_docker.py b/glances/plugins/glances_docker.py index da96235e..281b280e 100644 --- a/glances/plugins/glances_docker.py +++ b/glances/plugins/glances_docker.py @@ -153,8 +153,6 @@ class Plugin(GlancesPlugin): # Not available pass - logger.info(self.stats) - return self.stats def get_docker_cpu(self, id):