From 7e9b66128bca5f91410ef7165601f72ecd2784fc Mon Sep 17 00:00:00 2001 From: nicolargo Date: Mon, 24 Jul 2017 08:42:41 +0200 Subject: [PATCH 1/2] Solve issue with alias and upper case in the network interface (issue #1126) --- conf/glances.conf | 2 ++ glances/plugins/glances_plugin.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/conf/glances.conf b/conf/glances.conf index a7dc1cb4..85699774 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -122,6 +122,8 @@ tx_critical=90 #hide=docker.*,lo # WLAN 0 alias #wlan0_alias=Wireless IF +Ethernet 1_alias=Eth1 +hide=Eth.* # 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 diff --git a/glances/plugins/glances_plugin.py b/glances/plugins/glances_plugin.py index 98bec585..31608d1e 100644 --- a/glances/plugins/glances_plugin.py +++ b/glances/plugins/glances_plugin.py @@ -727,8 +727,10 @@ class GlancesPlugin(object): def has_alias(self, header): """Return the alias name for the relative header or None if nonexist.""" try: - return self._limits[self.plugin_name + '_' + header + '_' + 'alias'][0] + # Force to lower case (issue #1126) + return self._limits[self.plugin_name + '_' + header.lower() + '_' + 'alias'][0] except (KeyError, IndexError): + # logger.debug("No alias found for {}".format(header)) return None def msg_curse(self, args=None, max_width=None): From 4478faf984c4c2c23184ac18a7b8eaf5525d5609 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Mon, 24 Jul 2017 08:48:15 +0200 Subject: [PATCH 2/2] Solve issue with hide and upper case in the network interface (issue #1126) --- NEWS | 1 + conf/glances.conf | 2 -- glances/plugins/glances_plugin.py | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index f1f95761..28afca9d 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,7 @@ Bugs corrected: * GPU plugin. : ... not JSON serializable"> (issue #1112) * PermissionError on macOS (issue #1120) * Cant move up or down in glances --browser (issue #1113) + * Unable to give aliases to or hide network interfaces and disks (issue #1126) Installation: diff --git a/conf/glances.conf b/conf/glances.conf index 85699774..a7dc1cb4 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -122,8 +122,6 @@ tx_critical=90 #hide=docker.*,lo # WLAN 0 alias #wlan0_alias=Wireless IF -Ethernet 1_alias=Eth1 -hide=Eth.* # 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 diff --git a/glances/plugins/glances_plugin.py b/glances/plugins/glances_plugin.py index 31608d1e..ffeb7a17 100644 --- a/glances/plugins/glances_plugin.py +++ b/glances/plugins/glances_plugin.py @@ -722,7 +722,7 @@ class GlancesPlugin(object): hide=sda2,sda5,loop.* """ # TODO: possible optimisation: create a re.compile list - return not all(j is None for j in [re.match(i, value) for i in self.get_conf_value('hide', header=header)]) + return not all(j is None for j in [re.match(i, value.lower()) for i in self.get_conf_value('hide', header=header)]) def has_alias(self, header): """Return the alias name for the relative header or None if nonexist."""