diff options
author | nicolargo <nicolas@nicolargo.com> | 2019-10-12 11:10:52 +0200 |
---|---|---|
committer | nicolargo <nicolas@nicolargo.com> | 2019-10-12 11:10:52 +0200 |
commit | a61c91b111f06523e8f265b7fcd63284833ad0dc (patch) | |
tree | 80ca5475d1c92cff747c48c2376f06017250b49a | |
parent | 7c5d332aa3fb9c4c4f392bab31a35a8572923559 (diff) |
Correct an issue when a plugin is disabled from the cconf file
-rw-r--r-- | conf/glances.conf | 30 | ||||
-rw-r--r-- | glances/main.py | 14 | ||||
-rw-r--r-- | glances/plugins/glances_plugin.py | 10 | ||||
-rw-r--r-- | glances/plugins/glances_quicklook.py | 5 |
4 files changed, 37 insertions, 22 deletions
diff --git a/conf/glances.conf b/conf/glances.conf index 028def5a..c967e9c6 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -25,7 +25,7 @@ max_processes_display=30 [quicklook] # Set to true to disable a plugin -# Note: you can also disable it from the command line (see --disable-plugin) +# Note: you can also disable it from the command line (see --disable-plugin <plugin_name>) disable=False # Graphical percentage char used in the terminal user interface (default is |) percentage_char=| @@ -67,6 +67,7 @@ steal_critical=90 #ctx_switches_critical=14000 [percpu] +disable=False # Define CPU thresholds in % # Default values if not defined: 50/70/90 user_careful=50 @@ -80,6 +81,7 @@ system_warning=70 system_critical=90 [gpu] +disable=False # Default processor values if not defined: 50/70/90 proc_careful=50 proc_warning=70 @@ -90,6 +92,7 @@ mem_warning=70 mem_critical=90 [mem] +disable=False # Define RAM thresholds in % # Default values if not defined: 50/70/90 careful=50 @@ -98,6 +101,7 @@ warning=70 critical=90 [memswap] +disable=False # Define SWAP thresholds in % # Default values if not defined: 50/70/90 careful=50 @@ -105,6 +109,7 @@ warning=70 critical=90 [load] +disable=False # Define LOAD thresholds # Value * number of cores # Default values if not defined: 0.7/1.0/5.0 per number of cores @@ -116,6 +121,7 @@ critical=5.0 #log=False [network] +disable=False # Default bitrate thresholds in % of the network interface speed # Default values if not defined: 70/80/90 rx_careful=70 @@ -141,7 +147,7 @@ tx_critical=90 [connections] # Display additional information about TCP connections -# This plugin will be disable by default +# This plugin is disabled by default disable=True # nf_conntrack thresholds in % nf_conntrack_percent_careful=70 @@ -149,6 +155,7 @@ nf_conntrack_percent_warning=80 nf_conntrack_percent_critical=90 [wifi] +disable=False # Define the list of hidden wireless network interfaces (comma-separated regexp) hide=lo,docker.* # Define SIGNAL thresholds in db (lower is better...) @@ -158,6 +165,7 @@ warning=-75 critical=-85 [diskio] +disable=False # Define the list of hidden disks (comma-separated regexp) #hide=sda2,sda5,loop.* hide=loop.*,/dev/loop* @@ -165,6 +173,7 @@ hide=loop.*,/dev/loop* #sda1_alias=IntDisk [fs] +disable=False # Define the list of hidden file system (comma-separated regexp) hide=/boot.*,/snap.* # Define filesystem space thresholds in % @@ -178,6 +187,7 @@ critical=90 #allow=zfs [folders] +disable=False # Define a folder list to monitor # The list is composed of items (list_#nb <= 10) # An item is defined by: @@ -197,12 +207,21 @@ critical=90 #folder_3_path=/nonexisting #folder_4_path=/root +[irq] +# This plugin is disabled by default +# Documentation: https://glances.readthedocs.io/en/stable/aoa/irq.html +disable=False + [hddtemp] +disable=False # Define hddtemp server IP and port (default is 127.0.0.1 and 7634 (TCP)) 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 # Sensors core thresholds (in Celsius...) # Default values if not defined: 60/70/80 temperature_core_careful=60 @@ -224,6 +243,7 @@ battery_critical=95 #core 1_alias=CPU Core 1 [processlist] +disable=False # Define CPU/MEM (per process) thresholds in % # Default values if not defined: 50/70/90 cpu_careful=50 @@ -245,8 +265,9 @@ nice_warning=-20,-19,-18,-17,-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2 #nice_critical=15,16,17,18,19 [ports] -# Ports scanner plugin configuration +disable=False # Interval in second between two scans +# Ports scanner plugin configuration refresh=30 # Set the default timeout (in second) for a scan (can be overwritten in the scan list) timeout=3 @@ -290,8 +311,9 @@ port_default_gateway=True #web_4_description=Intranet [docker] -# Thresholds for CPU and MEM (in %) +disable=False #cpu_careful=50 +# Thresholds for CPU and MEM (in %) #cpu_warning=70 #cpu_critical=90 #mem_careful=20 diff --git a/glances/main.py b/glances/main.py index 24efe84a..18bc71ff 100644 --- a/glances/main.py +++ b/glances/main.py @@ -267,16 +267,16 @@ Examples of use: simplefilter("ignore") # Plugins disable/enable + # Allow users to disable plugins from the glances.conf (issue #1378) + for s in self.config.sections(): + if self.config.has_section(s) \ + and (self.config.get_bool_value(s, 'disable', False)): + disable(args, s) + logger.debug('{} disabled by the configuration file'.format(s)) + # The configuration key can be overwrite from the command line if args.disable_plugin is not None: for p in args.disable_plugin.split(','): disable(args, p) - else: - # Allow users to disable plugins from the glances.conf (issue #1378) - for s in self.config.sections(): - if self.config.has_section(s) \ - and (self.config.get_bool_value(s, 'disable', False)): - disable(args, s) - logger.debug('{} disabled by the configuration file'.format(s)) # Exporters activation if args.export is not None: diff --git a/glances/plugins/glances_plugin.py b/glances/plugins/glances_plugin.py index 0856cac3..6a1c8606 100644 --- a/glances/plugins/glances_plugin.py +++ b/glances/plugins/glances_plugin.py @@ -86,13 +86,10 @@ class GlancesPlugin(object): self.stats_history = self.init_stats_history() # Init the limits (configuration keys) dictionnary + logger.debug('Load section {} in {}'.format(self.plugin_name, + config.config_file_paths())) self._limits = dict() - if not self.load_limits(config=config): - logger.debug('Can not load section {} in {}'.format(self.plugin_name, - config)) - else: - logger.debug('Load section {} in {}'.format(self.plugin_name, - config)) + self.load_limits(config=config) # Init the actions self.actions = GlancesActions(args=args) @@ -503,6 +500,7 @@ class GlancesPlugin(object): return False # Read the global section + # @TODO: not optimized because this section is loaded for each plugin... if config.has_section('global'): self._limits['history_size'] = config.get_float_value('global', 'history_size', default=28800) logger.debug("Load configuration key: {} = {}".format('history_size', self._limits['history_size'])) diff --git a/glances/plugins/glances_quicklook.py b/glances/plugins/glances_quicklook.py index 77645ab6..456ecb12 100644 --- a/glances/plugins/glances_quicklook.py +++ b/glances/plugins/glances_quicklook.py @@ -67,11 +67,6 @@ class Plugin(GlancesPlugin): # We want to display the stat in the curse interface self.display_curse = True - # !!! @TODO: Debug disable / enable from conf file - # logger.info(args) - # logger.info(config.as_dict()['quicklook']) - # logger.info(self.is_enable()) - @GlancesPlugin._check_decorator @GlancesPlugin._log_result_decorator def update(self): |