From 871b4c32b22581242c326b67459c2a86f97c6c4a Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 13 Mar 2021 08:36:48 +0100 Subject: [PATCH] Reaplly the Add hide option to sensors plugin #1596 PR --- conf/glances.conf | 7 ++++--- glances/plugins/glances_sensors.py | 12 ++++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/conf/glances.conf b/conf/glances.conf index 47481e3c..d7c7d87a 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -230,9 +230,10 @@ host=127.0.0.1 port=7634 [sensors] -# This plugin is disable by default because on some system, the PsUtil -# consume a lot of CPU to grab the stats... -disable=True +# Documentation: https://glances.readthedocs.io/en/latest/aoa/sensors.html +disable=False +# Hide some sensors +#hide=ambient # Sensors core thresholds (in Celsius...) # Default values if not defined: 60/70/80 temperature_core_careful=60 diff --git a/glances/plugins/glances_sensors.py b/glances/plugins/glances_sensors.py index 4917de7b..03f0beed 100644 --- a/glances/plugins/glances_sensors.py +++ b/glances/plugins/glances_sensors.py @@ -127,14 +127,18 @@ class Plugin(GlancesPlugin): pass - # Set the alias for each stat + # Global change on stats + self.stats = self.get_init_value() for stat in stats: + # Do not take hide stat into account + if self.is_hide(stat["label"].lower()): + continue + # Set the alias for each stat alias = self.has_alias(stat["label"].lower()) if alias: stat["label"] = alias - - # Update the stats - self.stats = stats + # Update the stats + self.stats.append(stat) return self.stats