提交 1f8e6efe 编写于 作者: N nicolargo

Add --enable-plugin options from the command line

上级 a61c91b1
...@@ -15,3 +15,6 @@ There is no alert on this information. ...@@ -15,3 +15,6 @@ There is no alert on this information.
.. note:: .. note::
Limit values and sensors alias names can be defined in the Limit values and sensors alias names can be defined in the
configuration file under the ``[sensors]`` section. configuration file under the ``[sensors]`` section.
.. note::
This plugin is disabled by default in the configuration file.
...@@ -30,6 +30,10 @@ Command-Line Options ...@@ -30,6 +30,10 @@ Command-Line Options
disable PLUGIN (comma separed list) disable PLUGIN (comma separed list)
.. option:: --enable-plugin PLUGIN
enable PLUGIN (comma separed list)
.. option:: --stdout PLUGINS_STATS .. option:: --stdout PLUGINS_STATS
display stats to stdout (comma separated list of plugins/plugins.attribute) display stats to stdout (comma separated list of plugins/plugins.attribute)
......
...@@ -48,7 +48,7 @@ have a section. Below an example for the CPU plugin: ...@@ -48,7 +48,7 @@ have a section. Below an example for the CPU plugin:
.. code-block:: ini .. code-block:: ini
[cpu] [cpu]
disable=false disable=False
user_careful=50 user_careful=50
user_warning=70 user_warning=70
user_critical=90 user_critical=90
......
.\" Man page generated from reStructuredText. .\" 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 .SH NAME
glances \- An eye on your system glances \- An eye on your system
. .
...@@ -78,6 +78,11 @@ disable PLUGIN (comma separed list) ...@@ -78,6 +78,11 @@ disable PLUGIN (comma separed list)
.UNINDENT .UNINDENT
.INDENT 0.0 .INDENT 0.0
.TP .TP
.B \-\-enable\-plugin PLUGIN
enable PLUGIN (comma separed list)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-stdout PLUGINS_STATS .B \-\-stdout PLUGINS_STATS
display stats to stdout (comma separated list of plugins/plugins.attribute) display stats to stdout (comma separated list of plugins/plugins.attribute)
.UNINDENT .UNINDENT
...@@ -389,6 +394,9 @@ Sort processes by I/O rate ...@@ -389,6 +394,9 @@ Sort processes by I/O rate
.B \fBI\fP .B \fBI\fP
Show/hide IP module Show/hide IP module
.TP .TP
.B \fBk\fP
Show/hide TCP connections
.TP
.B \fBl\fP .B \fBl\fP
Show/hide log messages Show/hide log messages
.TP .TP
...@@ -569,7 +577,7 @@ have a section. Below an example for the CPU plugin: ...@@ -569,7 +577,7 @@ have a section. Below an example for the CPU plugin:
.nf .nf
.ft C .ft C
[cpu] [cpu]
disable=false disable=False
user_careful=50 user_careful=50
user_warning=70 user_warning=70
user_critical=90 user_critical=90
......
...@@ -98,8 +98,11 @@ Examples of use: ...@@ -98,8 +98,11 @@ Examples of use:
Display CSV stats to stdout (all stats in one line): Display CSV stats to stdout (all stats in one line):
$ glances --stdout-csv now,cpu.user,mem.used,load $ 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 $ glances --disable-plugin network,ports
Enable some plugins (comma separated list):
$ glances --enable-plugin sensors
""" """
def __init__(self): def __init__(self):
...@@ -126,8 +129,10 @@ Examples of use: ...@@ -126,8 +129,10 @@ Examples of use:
action='store_true', default=False, action='store_true', default=False,
dest='modules_list', dest='modules_list',
help='display modules (plugins & exports) list and exit') 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)') 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, parser.add_argument('--disable-process', action='store_true', default=False,
dest='disable_process', help='disable process module') dest='disable_process', help='disable process module')
# Enable or disable option # Enable or disable option
...@@ -277,6 +282,9 @@ Examples of use: ...@@ -277,6 +282,9 @@ Examples of use:
if args.disable_plugin is not None: if args.disable_plugin is not None:
for p in args.disable_plugin.split(','): for p in args.disable_plugin.split(','):
disable(args, p) disable(args, p)
if args.enable_plugin is not None:
for p in args.enable_plugin.split(','):
enable(args, p)
# Exporters activation # Exporters activation
if args.export is not None: if args.export is not None:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册