Set sensor refresh time at Glances refresh * 3

This commit is contained in:
nicolargo 2024-04-30 17:02:34 +02:00
parent 3aa6be7361
commit e2e2264a4d
3 changed files with 14 additions and 8 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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."""