diff options
-rw-r--r-- | conf/glances.conf | 30 | ||||
-rw-r--r-- | docs/aoa/sensors.rst | 3 | ||||
-rw-r--r-- | docs/cmds.rst | 4 | ||||
-rw-r--r-- | docs/config.rst | 2 | ||||
-rw-r--r-- | docs/man/glances.1 | 12 | ||||
-rw-r--r-- | glances/main.py | 26 | ||||
-rw-r--r-- | glances/plugins/glances_plugin.py | 10 | ||||
-rw-r--r-- | glances/plugins/glances_quicklook.py | 5 |
8 files changed, 65 insertions, 27 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/docs/aoa/sensors.rst b/docs/aoa/sensors.rst index 6f697dc4..9aca0b5d 100644 --- a/docs/aoa/sensors.rst +++ b/docs/aoa/sensors.rst @@ -15,3 +15,6 @@ There is no alert on this information. .. note:: Limit values and sensors alias names can be defined in the configuration file under the ``[sensors]`` section. + +.. note:: + This plugin is disabled by default in the configuration file. diff --git a/docs/cmds.rst b/docs/cmds.rst index 3b85cc28..a4c88179 100644 --- a/docs/cmds.rst +++ b/docs/cmds.rst @@ -30,6 +30,10 @@ Command-Line Options disable PLUGIN (comma separed list) +.. option:: --enable-plugin PLUGIN + + enable PLUGIN (comma separed list) + .. option:: --stdout PLUGINS_STATS display stats to stdout (comma separated list of plugins/plugins.attribute) diff --git a/docs/config.rst b/docs/config.rst index 60edfbfe..875a2b35 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -48,7 +48,7 @@ have a section. Below an example for the CPU plugin: .. code-block:: ini [cpu] - disable=false + disable=False user_careful=50 user_warning=70 user_critical=90 diff --git a/docs/man/glances.1 b/docs/man/glances.1 index 290f76da..6789fcc3 100644 --- a/docs/man/glances.1 +++ b/docs/man/glances.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "GLANCES" "1" "Oct 07, 2019" "3.1.3_BETA" "Glances" +.TH "GLANCES" "1" "Oct 12, 2019" "3.1.3_BETA" "Glances" .SH NAME glances \- An eye on your system . @@ -78,6 +78,11 @@ disable PLUGIN (comma separed list) .UNINDENT .INDENT 0.0 .TP +.B \-\-enable\-plugin PLUGIN +enable PLUGIN (comma separed list) +.UNINDENT +.INDENT 0.0 +.TP .B \-\-stdout PLUGINS_STATS display stats to stdout (comma separated list of plugins/plugins.attribute) .UNINDENT @@ -389,6 +394,9 @@ Sort processes by I/O rate .B \fBI\fP Show/hide IP module .TP +.B \fBk\fP +Show/hide TCP connections +.TP .B \fBl\fP Show/hide log messages .TP @@ -569,7 +577,7 @@ have a section. Below an example for the CPU plugin: .nf .ft C [cpu] -disable=false +disable=False user_careful=50 user_warning=70 user_critical=90 diff --git a/glances/main.py b/glances/main.py index c818b13e..0b5f070b 100644 --- a/glances/main.py +++ b/glances/main.py @@ -98,8 +98,11 @@ Examples of use: Display CSV stats to stdout (all stats in one line): $ glances --stdout-csv now,cpu.user,mem.used,load - Disable some plugins (any modes): + Disable some plugins (comma separated list): $ glances --disable-plugin network,ports + + Enable some plugins (comma separated list): + $ glances --enable-plugin sensors """ def __init__(self): @@ -126,8 +129,10 @@ Examples of use: action='store_true', default=False, dest='modules_list', help='display modules (plugins & exports) list and exit') - parser.add_argument('--disable-plugin', dest='disable_plugin', + parser.add_argument('--disable-plugin', '--disable-plugins', dest='disable_plugin', help='disable plugin (comma separed list)') + parser.add_argument('--enable-plugin', '--enable-plugins', dest='enable_plugin', + help='enable plugin (comma separed list)') parser.add_argument('--disable-process', action='store_true', default=False, dest='disable_process', help='disable process module') # Enable or disable option @@ -267,16 +272,19 @@ 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)) + if args.enable_plugin is not None: + for p in args.enable_plugin.split(','): + enable(args, p) # 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): |