summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolargo <nicolashennion@gmail.com>2024-04-27 16:28:38 +0200
committernicolargo <nicolashennion@gmail.com>2024-04-27 16:28:38 +0200
commit81668fc947e263dc025d059432472774a4ee84c5 (patch)
treefdc61994d8f74ca82e849f2546bf529d43938c80
parente4a6638c305f241b954db4bbc901250ec4ee6956 (diff)
Correct issue with Alias in sensors
-rw-r--r--conf/glances.conf6
-rw-r--r--glances/plugins/plugin/model.py4
-rw-r--r--glances/plugins/sensors/__init__.py8
3 files changed, 9 insertions, 9 deletions
diff --git a/conf/glances.conf b/conf/glances.conf
index 41ed2c12..412b702c 100644
--- a/conf/glances.conf
+++ b/conf/glances.conf
@@ -335,8 +335,10 @@ port=7634
disable=False
# By default refresh every refresh time * 2
#refresh=6
-# Hide some sensors
-#hide=ambient
+# Hide some sensors (comma separated list of regexp)
+hide=unknown.*
+# Show only the following sensors (comma separated list of regexp)
+#show=CPU.*
# Sensors core thresholds (in Celsius...)
# Default values are grabbed from the system
#temperature_core_careful=45
diff --git a/glances/plugins/plugin/model.py b/glances/plugins/plugin/model.py
index d6b84e09..5a65d9a0 100644
--- a/glances/plugins/plugin/model.py
+++ b/glances/plugins/plugin/model.py
@@ -2,7 +2,7 @@
#
# This file is part of Glances.
#
-# SPDX-FileCopyrightText: 2022 Nicolas Hennion <nicolas@nicolargo.com>
+# SPDX-FileCopyrightText: 2024 Nicolas Hennion <nicolas@nicolargo.com>
#
# SPDX-License-Identifier: LGPL-3.0-only
#
@@ -908,7 +908,7 @@ class GlancesPluginModel(object):
def read_alias(self):
if self.plugin_name + '_' + 'alias' in self._limits:
- return {i.split(':')[0]: i.split(':')[1] for i in self._limits[self.plugin_name + '_' + 'alias'][0].split(',')}
+ return {i.split(':')[0].lower(): i.split(':')[1] for i in self._limits[self.plugin_name + '_' + 'alias']}
else:
return dict()
diff --git a/glances/plugins/sensors/__init__.py b/glances/plugins/sensors/__init__.py
index ae8e087a..40d5103c 100644
--- a/glances/plugins/sensors/__init__.py
+++ b/glances/plugins/sensors/__init__.py
@@ -56,6 +56,7 @@ fields_description = {
},
}
+
class PluginModel(GlancesPluginModel):
"""Glances sensors plugin.
@@ -155,13 +156,10 @@ class PluginModel(GlancesPluginModel):
# Global change on stats
self.stats = self.get_init_value()
for stat in stats:
- # Do not take hide stat into account
+ # Hide sensors configured in the hide ou show configuration key
if not self.is_display(stat["label"].lower()):
continue
- # Set the alias for each stat
- # alias = self.has_alias(stat["label"].lower())
- # if alias:
- # stat["label"] = alias
+ # Set alias for sensors
stat["label"] = self.__get_alias(stat)
# Update the stats
self.stats.append(stat)