diff --git a/conf/glances.conf b/conf/glances.conf index 22bd435d..c6dc652e 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -222,6 +222,8 @@ hide_no_up=True hide_no_ip=True # Set hide_zero to True to automatically hide interface with no traffic hide_zero=False +# Set hide_threshold_bytes to an integer value to automatically hide interface with traffic less than this value +hide_threshold_bytes=0 # It is possible to overwrite the bitrate thresholds per interface # WLAN 0 Default limits (in bits per second aka bps) for interface bitrate #wlan0_rx_careful=4000000 @@ -284,6 +286,8 @@ disable=False hide=loop.*,/dev/loop.* # Set hide_zero to True to automatically hide disk with no read/write hide_zero=False +# Set hide_threshold_bytes to an integer value to automatically hide disk with read/write less than this value +hide_threshold_bytes=0 # Define the list of disks to be show (comma-separated) #show=sda.* # Alias for sda1 and sdb1 diff --git a/docker-compose/glances.conf b/docker-compose/glances.conf index befe1bb3..5352d5bd 100755 --- a/docker-compose/glances.conf +++ b/docker-compose/glances.conf @@ -13,7 +13,7 @@ check_update=False # Default is 1200 values (~1h with the default refresh rate) history_size=1200 # Set the way Glances should display the date (default is %Y-%m-%d %H:%M:%S %Z) -#strftime_format=%Y-%m-%d %H:%M:%S %Z +# strftime_format=%Y-%m-%d %H:%M:%S %Z # Define external directory for loading additional plugins # The layout follows the glances standard for plugin definitions #plugin_dir=/home/user/dev/plugins @@ -222,6 +222,8 @@ hide_no_up=True hide_no_ip=True # Set hide_zero to True to automatically hide interface with no traffic hide_zero=False +# Set hide_threshold_bytes to an integer value to automatically hide interface with traffic less than this value +hide_threshold_bytes=0 # It is possible to overwrite the bitrate thresholds per interface # WLAN 0 Default limits (in bits per second aka bps) for interface bitrate #wlan0_rx_careful=4000000 @@ -284,6 +286,8 @@ disable=False hide=loop.*,/dev/loop.* # Set hide_zero to True to automatically hide disk with no read/write hide_zero=False +# Set hide_threshold_bytes to an integer value to automatically hide disk with read/write less than this value +hide_threshold_bytes=0 # Define the list of disks to be show (comma-separated) #show=sda.* # Alias for sda1 and sdb1 diff --git a/glances/plugins/diskio/__init__.py b/glances/plugins/diskio/__init__.py index a4b314ec..283cedba 100644 --- a/glances/plugins/diskio/__init__.py +++ b/glances/plugins/diskio/__init__.py @@ -73,8 +73,10 @@ class PluginModel(GlancesPluginModel): # Hide stats if it has never been != 0 if config is not None: self.hide_zero = config.get_bool_value(self.plugin_name, 'hide_zero', default=False) + self.hide_threshold_bytes = config.get_int_value(self.plugin_name, 'hide_threshold_bytes', default=0) else: self.hide_zero = False + self.hide_threshold_bytes = 0 self.hide_zero_fields = ['read_bytes_rate_per_sec', 'write_bytes_rate_per_sec'] # Force a first update because we need two updates to have the first stat diff --git a/glances/plugins/plugin/model.py b/glances/plugins/plugin/model.py index 8f7982a8..f072d10c 100644 --- a/glances/plugins/plugin/model.py +++ b/glances/plugins/plugin/model.py @@ -110,6 +110,8 @@ class GlancesPluginModel: # Hide stats if all the hide_zero_fields has never been != 0 # Default is False, always display stats self.hide_zero = False + # The threshold needed to display a value if hide_zero is true. Only hide a value if it is less than hide_threshold_bytes. + self.hide_threshold_bytes = 0 self.hide_zero_fields = [] # Set the initial refresh time to display stats the first time @@ -463,7 +465,7 @@ class GlancesPluginModel: value['hidden'] = False elif key in self.views and field in self.views[key] and 'hidden' in self.views[key][field]: value['hidden'] = self.views[key][field]['hidden'] - if field in self.hide_zero_fields and i[field] != 0: + if field in self.hide_zero_fields and i[field] >= self.hide_threshold_bytes: value['hidden'] = False else: value['hidden'] = field in self.hide_zero_fields @@ -485,7 +487,7 @@ class GlancesPluginModel: value['hidden'] = False elif field in self.views and 'hidden' in self.views[field]: value['hidden'] = self.views[field]['hidden'] - if field in self.hide_zero_fields and self.get_raw()[field] != 0: + if field in self.hide_zero_fields and self.get_raw()[field] >= self.hide_threshold_bytes: value['hidden'] = False else: value['hidden'] = field in self.hide_zero_fields