Add --enable-plugin options from the command line

This commit is contained in:
nicolargo 2019-10-12 11:21:47 +02:00
parent a61c91b111
commit 1f8e6efe8c
5 changed files with 28 additions and 5 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -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
@ -277,6 +282,9 @@ Examples of use:
if args.disable_plugin is not None:
for p in args.disable_plugin.split(','):
disable(args, p)
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: