summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolargo <nicolashennion@gmail.com>2024-04-30 17:02:34 +0200
committernicolargo <nicolashennion@gmail.com>2024-04-30 17:02:34 +0200
commite2e2264a4d270a203686822ad7643b13d0b1b2e5 (patch)
tree9fae44cbff5b24f51261d71b9e1e4eefebc2d78c
parent3aa6be73619b16da4560ead62204de1d5a274fa6 (diff)
Set sensor refresh time at Glances refresh * 3
-rw-r--r--conf/glances.conf7
-rwxr-xr-xdocker-compose/glances.conf7
-rw-r--r--glances/plugins/sensors/__init__.py8
3 files changed, 14 insertions, 8 deletions
diff --git a/conf/glances.conf b/conf/glances.conf
index 10f48a6d..a7ed6374 100644
--- a/conf/glances.conf
+++ b/conf/glances.conf
@@ -239,7 +239,7 @@ public_template={continent_name}/{country_name}/{city_name}
[connections]
# Display additional information about TCP connections
-# This plugin is disabled by default
+# This plugin is disabled by default because it consumes lots of CPU
disable=True
# nf_conntrack thresholds in %
nf_conntrack_percent_careful=70
@@ -333,8 +333,9 @@ port=7634
[sensors]
# Documentation: https://glances.readthedocs.io/en/latest/aoa/sensors.html
disable=False
-# By default refresh every refresh time * 2
-#refresh=6
+# Set the refresh multiplicator for the sensors
+# By default refresh every Glances refresh * 3 (increase to reduce CPU consumption)
+#refresh=3
# Hide some sensors (comma separated list of regexp)
hide=unknown.*
# Show only the following sensors (comma separated list of regexp)
diff --git a/docker-compose/glances.conf b/docker-compose/glances.conf
index 74362ea9..225700fa 100755
--- a/docker-compose/glances.conf
+++ b/docker-compose/glances.conf
@@ -239,7 +239,7 @@ public_template={continent_name}/{country_name}/{city_name}
[connections]
# Display additional information about TCP connections
-# This plugin is disabled by default
+# This plugin is disabled by default because it consumes lots of CPU
disable=True
# nf_conntrack thresholds in %
nf_conntrack_percent_careful=70
@@ -333,8 +333,9 @@ port=7634
[sensors]
# Documentation: https://glances.readthedocs.io/en/latest/aoa/sensors.html
disable=False
-# By default refresh every refresh time * 2
-#refresh=6
+# Set the refresh multiplicator for the sensors
+# By default refresh every Glances refresh * 3 (increase to reduce CPU consumption)
+#refresh=3
# Hide some sensors (comma separated list of regexp)
hide=unknown.*
# Show only the following sensors (comma separated list of regexp)
diff --git a/glances/plugins/sensors/__init__.py b/glances/plugins/sensors/__init__.py
index adeda67f..35e04678 100644
--- a/glances/plugins/sensors/__init__.py
+++ b/glances/plugins/sensors/__init__.py
@@ -26,6 +26,11 @@ SENSOR_TEMP_UNIT = 'C'
SENSOR_FAN_TYPE = 'fan_speed'
SENSOR_FAN_UNIT = 'R'
+# Define the default refresh multiplicator
+# Default value is 3 * Glances refresh time
+# Can be overwritten by the refresh option in the sensors section of the glances.conf file
+DEFAULT_REFRESH = 3
+
# Fields description
# description: human readable description
# short_name: shortname to use un UI
@@ -96,9 +101,8 @@ class PluginModel(GlancesPluginModel):
self.display_curse = True
# Not necessary to refresh every refresh time
- # By default set to refresh * 2
if self.get_refresh() == args.time:
- self.set_refresh(self.get_refresh() * 2)
+ self.set_refresh(self.get_refresh() * DEFAULT_REFRESH)
def get_key(self):
"""Return the key of the list."""