提交 4f7f6be6 编写于 作者: N nicolargo

Merge branch 'issue1173' into develop

...@@ -11,6 +11,7 @@ Enhancements and new features: ...@@ -11,6 +11,7 @@ Enhancements and new features:
* A way to have only REST API available and disable WEB GUI access #1149 * A way to have only REST API available and disable WEB GUI access #1149
* Docker module doesn't export details about stopped containers #1152 * Docker module doesn't export details about stopped containers #1152
* Add dynamic fields in all sections of the configuration file #1204 * Add dynamic fields in all sections of the configuration file #1204
* Make plugins disable and export CLI option dynamical #1173
* Add a light mode for the console UI #1165 * Add a light mode for the console UI #1165
* Refactor InfluxDB (API is now stable) #1166 * Refactor InfluxDB (API is now stable) #1166
...@@ -33,19 +34,35 @@ Backward-incompatible changes: ...@@ -33,19 +34,35 @@ Backward-incompatible changes:
* Minimum supported Docker API version is now 1.21 (Docker plugins) * Minimum supported Docker API version is now 1.21 (Docker plugins)
* Support for InfluxDB < 0.9 is deprecated (InfluxDB exporter) * Support for InfluxDB < 0.9 is deprecated (InfluxDB exporter)
* --disable-<plugin> no longer available (use --disable-plugin <plugin>)
* --export-<exporter> no longer available (use --export <exporter>)
News command line options: News command line options:
--disable-webui Disable the WebUI (only Restful API will respond) --disable-webui Disable the WebUI (only Restful API will respond)
--enable-light Enable the light mode for the UI interface --enable-light Enable the light mode for the UI interface
--modules-list Display plugins and exporters list
--disable-plugin plugin1,plugin2
Disable a list of comma separated plugins
--export exporter1,exporter2
Export stats to a comma separated exporters
News configuration keys in the glances.conf file: News configuration keys in the glances.conf file:
Docker plugin (related to #1152)
[docker] [docker]
# By default, Glances only display running containers # By default, Glances only display running containers
# Set the following key to True to display all containers # Set the following key to True to display all containers
all=False all=False
All configuration file values (related to #1204)
[influxdb]
# It is possible to use dynamic system command
prefix=`hostname`
tags=foo:bar,spam:eggs,system:`uname -a`
============================================================================== ==============================================================================
Glances Version 2 Glances Version 2
============================================================================== ==============================================================================
......
...@@ -305,7 +305,7 @@ all=False ...@@ -305,7 +305,7 @@ all=False
############################################################################## ##############################################################################
[influxdb] [influxdb]
# Configuration for the --export-influxdb option # Configuration for the --export influxdb option
# https://influxdb.com/ # https://influxdb.com/
host=localhost host=localhost
port=8086 port=8086
...@@ -325,7 +325,7 @@ prefix=localhost ...@@ -325,7 +325,7 @@ prefix=localhost
#tags=system:`uname -s` #tags=system:`uname -s`
[cassandra] [cassandra]
# Configuration for the --export-cassandra option # Configuration for the --export cassandra option
# Also works for the ScyllaDB # Also works for the ScyllaDB
# https://influxdb.com/ or http://www.scylladb.com/ # https://influxdb.com/ or http://www.scylladb.com/
host=localhost host=localhost
...@@ -337,7 +337,7 @@ replication_factor=2 ...@@ -337,7 +337,7 @@ replication_factor=2
table=localhost table=localhost
[opentsdb] [opentsdb]
# Configuration for the --export-opentsdb option # Configuration for the --export opentsdb option
# http://opentsdb.net/ # http://opentsdb.net/
host=localhost host=localhost
port=4242 port=4242
...@@ -345,14 +345,14 @@ port=4242 ...@@ -345,14 +345,14 @@ port=4242
#tags=foo:bar,spam:eggs #tags=foo:bar,spam:eggs
[statsd] [statsd]
# Configuration for the --export-statsd option # Configuration for the --export statsd option
# https://github.com/etsy/statsd # https://github.com/etsy/statsd
host=localhost host=localhost
port=8125 port=8125
#prefix=glances #prefix=glances
[elasticsearch] [elasticsearch]
# Configuration for the --export-elasticsearch option # Configuration for the --export elasticsearch option
# Data are available via the ES Restful API. ex: URL/<index>/cpu/system # Data are available via the ES Restful API. ex: URL/<index>/cpu/system
# https://www.elastic.co # https://www.elastic.co
host=localhost host=localhost
...@@ -360,12 +360,13 @@ port=9200 ...@@ -360,12 +360,13 @@ port=9200
index=glances index=glances
[riemann] [riemann]
# Configuration for the --export-riemann option # Configuration for the --export riemann option
# http://riemann.io # http://riemann.io
host=localhost host=localhost
port=5555 port=5555
[rabbitmq] [rabbitmq]
# Configuration for the --export rabbitmq option
host=localhost host=localhost
port=5672 port=5672
user=guest user=guest
...@@ -373,7 +374,7 @@ password=guest ...@@ -373,7 +374,7 @@ password=guest
queue=glances_queue queue=glances_queue
[couchdb] [couchdb]
# Configuration for the --export-couchdb option # Configuration for the --export couchdb option
# https://www.couchdb.org # https://www.couchdb.org
host=localhost host=localhost
port=5984 port=5984
...@@ -383,7 +384,7 @@ db=glances ...@@ -383,7 +384,7 @@ db=glances
#password=root #password=root
[kafka] [kafka]
# Configuration for the --export-kafka option # Configuration for the --export kafka option
# http://kafka.apache.org/ # http://kafka.apache.org/
host=localhost host=localhost
port=9092 port=9092
...@@ -391,7 +392,7 @@ topic=glances ...@@ -391,7 +392,7 @@ topic=glances
#compression=gzip #compression=gzip
[zeromq] [zeromq]
# Configuration for the --export-zeromq option # Configuration for the --export zeromq option
# http://www.zeromq.org # http://www.zeromq.org
# Use * to bind on all interfaces # Use * to bind on all interfaces
host=* host=*
...@@ -403,7 +404,7 @@ port=5678 ...@@ -403,7 +404,7 @@ port=5678
prefix=G prefix=G
[prometheus] [prometheus]
# Configuration for the --export-prometheus option # Configuration for the --export prometheus option
# https://prometheus.io # https://prometheus.io
# Create a Prometheus exporter listening on localhost:9091 (default configuration) # Create a Prometheus exporter listening on localhost:9091 (default configuration)
# Metric are exporter using the following name: # Metric are exporter using the following name:
...@@ -419,7 +420,7 @@ port=9091 ...@@ -419,7 +420,7 @@ port=9091
prefix=glances prefix=glances
[restful] [restful]
# Configuration for the --export-restful option # Configuration for the --export restful option
# Example, export to http://localhost:6789/ # Example, export to http://localhost:6789/
host=localhost host=localhost
port=6789 port=6789
......
...@@ -22,90 +22,34 @@ Command-Line Options ...@@ -22,90 +22,34 @@ Command-Line Options
path to the configuration file path to the configuration file
.. option:: --disable-alert .. option:: -modules-list
disable alert/log module display modules (plugins & exports) list and exit
.. option:: --disable-amps .. option:: --disable-plugin PLUGIN
disable application monitoring process module disable PLUGIN (comma separed list)
.. option:: --disable-cpu .. option:: --export EXPORT
disable CPU module enable EXPORT module (comma separed list)
.. option:: --disable-diskio .. option:: --export-csv-file EXPORT_CSV_FILE
disable disk I/O module file path for CSV exporter
.. option:: --disable-docker .. option:: --export-json-file EXPORT_JSON_FILE
disable Docker module file path for JSON exporter
.. option:: --disable-folders
disable folders module
.. option:: --disable-fs
disable file system module
.. option:: --disable-hddtemp
disable HD temperature module
.. option:: --disable-ip
disable IP module
.. option:: --disable-irq
disable IRQ module
.. option:: --disable-load
disable load module
.. option:: --disable-mem
disable memory module
.. option:: --disable-memswap
disable memory swap module
.. option:: --disable-network
disable network module
.. option:: --disable-now
disable current time module
.. option:: --disable-ports
disable Ports module
.. option:: --disable-process .. option:: --disable-process
disable process module disable process module (reduce Glances CPU consumption)
.. option:: --disable-raid
disable RAID module
.. option:: --disable-sensors
disable sensors module
.. option:: --disable-webui .. option:: --disable-webui
disable the Web UI (only the Restful API will respond) disable the Web UI (only the Restful API will respond)
.. option:: --disable-wifi
disable Wifi module
.. option:: --light, --enable-light .. option:: --light, --enable-light
light mode for Curses UI (disable all but top menu) light mode for Curses UI (disable all but top menu)
...@@ -154,54 +98,6 @@ Command-Line Options ...@@ -154,54 +98,6 @@ Command-Line Options
enable extended stats on top process enable extended stats on top process
.. option:: --export-graph
export stats to graph
.. option:: --path-graph PATH_GRAPH
set the export path for graph history
.. option:: --export-csv EXPORT_CSV
export stats to a CSV file
.. option:: --export-cassandra
export stats to a Cassandra/Scylla server (cassandra lib needed)
.. option:: --export-couchdb
export stats to a CouchDB server (couchdb lib needed)
.. option:: --export-elasticsearch
export stats to an Elasticsearch server (elasticsearch lib needed)
.. option:: --export-influxdb
export stats to an InfluxDB server (influxdb lib needed)
.. option:: --export-opentsdb
export stats to an OpenTSDB server (potsdb lib needed)
.. option:: --export-rabbitmq
export stats to RabbitMQ broker (pika lib needed)
.. option:: --export-statsd
export stats to a StatsD server (statsd lib needed)
.. option:: --export-riemann
export stats to Riemann server (bernhard lib needed)
.. option:: --export-zeromq
export stats to a ZeroMQ server (zmq lib needed)
.. option:: -c CLIENT, --client CLIENT .. option:: -c CLIENT, --client CLIENT
connect to a Glances server by IPv4/IPv6 address, hostname or hostname:port connect to a Glances server by IPv4/IPv6 address, hostname or hostname:port
...@@ -409,7 +305,7 @@ The following commands (key pressed) are supported while in Glances: ...@@ -409,7 +305,7 @@ The following commands (key pressed) are supported while in Glances:
``p`` ``p``
Sort processes by name Sort processes by name
``q|ESC`` ``q|ESC|CTRL-C``
Quit the current Glances session Quit the current Glances session
``Q`` ``Q``
......
...@@ -66,7 +66,7 @@ an InfluxDB export module: ...@@ -66,7 +66,7 @@ an InfluxDB export module:
.. code-block:: ini .. code-block:: ini
[influxdb] [influxdb]
# Configuration for the --export-influxdb option # Configuration for the --export influxdb option
# https://influxdb.com/ # https://influxdb.com/
host=localhost host=localhost
port=8086 port=8086
......
...@@ -44,13 +44,17 @@ Monitor local machine with the web interface (Web UI): ...@@ -44,13 +44,17 @@ Monitor local machine with the web interface (Web UI):
Monitor local machine and export stats to a CSV file: Monitor local machine and export stats to a CSV file:
$ glances --export-csv $ glances --export csv --export-csv-file /tmp/glances.csv
Monitor local machine and export stats to a InfluxDB server with 5s Monitor local machine and export stats to a InfluxDB server with 5s
refresh time (also possible to export to OpenTSDB, Cassandra, Statsd, refresh time (also possible to export to OpenTSDB, Cassandra, Statsd,
ElasticSearch, RabbitMQ and Riemann): ElasticSearch, RabbitMQ and Riemann):
$ glances -t 5 --export-influxdb $ glances -t 5 --export influxdb
It is also possible to export stats to multiple endpoints:
$ glances -t 5 --export influxdb,statsd,csv
Start a Glances server (server mode): Start a Glances server (server mode):
...@@ -62,7 +66,7 @@ Connect Glances to a Glances server (client mode): ...@@ -62,7 +66,7 @@ Connect Glances to a Glances server (client mode):
Connect to a Glances server and export stats to a StatsD server: Connect to a Glances server and export stats to a StatsD server:
$ glances -c <ip_server> --export-statsd $ glances -c <ip_server> --export statsd
Start the client browser (browser mode): Start the client browser (browser mode):
......
.\" Man page generated from reStructuredText. .\" Man page generated from reStructuredText.
. .
.TH "GLANCES" "1" "Dec 26, 2017" "3.0_DEV" "Glances" .TH "GLANCES" "1" "Dec 28, 2017" "3.0_DEV" "Glances"
.SH NAME .SH NAME
glances \- An eye on your system glances \- An eye on your system
. .
...@@ -68,98 +68,33 @@ path to the configuration file ...@@ -68,98 +68,33 @@ path to the configuration file
.UNINDENT .UNINDENT
.INDENT 0.0 .INDENT 0.0
.TP .TP
.B \-\-disable\-alert .B \-modules\-list
disable alert/log module display modules (plugins & exports) list and exit
.UNINDENT .UNINDENT
.INDENT 0.0 .INDENT 0.0
.TP .TP
.B \-\-disable\-amps .B \-\-disable\-plugin PLUGIN
disable application monitoring process module disable PLUGIN (comma separed list)
.UNINDENT .UNINDENT
.INDENT 0.0 .INDENT 0.0
.TP .TP
.B \-\-disable\-cpu .B \-\-export EXPORT
disable CPU module enable EXPORT module (comma separed list)
.UNINDENT .UNINDENT
.INDENT 0.0 .INDENT 0.0
.TP .TP
.B \-\-disable\-diskio .B \-\-export\-csv\-file EXPORT_CSV_FILE
disable disk I/O module file path for CSV exporter
.UNINDENT .UNINDENT
.INDENT 0.0 .INDENT 0.0
.TP .TP
.B \-\-disable\-docker .B \-\-export\-json\-file EXPORT_JSON_FILE
disable Docker module file path for JSON exporter
.UNINDENT
.INDENT 0.0
.TP
.B \-\-disable\-folders
disable folders module
.UNINDENT
.INDENT 0.0
.TP
.B \-\-disable\-fs
disable file system module
.UNINDENT
.INDENT 0.0
.TP
.B \-\-disable\-hddtemp
disable HD temperature module
.UNINDENT
.INDENT 0.0
.TP
.B \-\-disable\-ip
disable IP module
.UNINDENT
.INDENT 0.0
.TP
.B \-\-disable\-irq
disable IRQ module
.UNINDENT
.INDENT 0.0
.TP
.B \-\-disable\-load
disable load module
.UNINDENT
.INDENT 0.0
.TP
.B \-\-disable\-mem
disable memory module
.UNINDENT
.INDENT 0.0
.TP
.B \-\-disable\-memswap
disable memory swap module
.UNINDENT
.INDENT 0.0
.TP
.B \-\-disable\-network
disable network module
.UNINDENT
.INDENT 0.0
.TP
.B \-\-disable\-now
disable current time module
.UNINDENT
.INDENT 0.0
.TP
.B \-\-disable\-ports
disable Ports module
.UNINDENT .UNINDENT
.INDENT 0.0 .INDENT 0.0
.TP .TP
.B \-\-disable\-process .B \-\-disable\-process
disable process module disable process module (reduce Glances CPU consumption)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-disable\-raid
disable RAID module
.UNINDENT
.INDENT 0.0
.TP
.B \-\-disable\-sensors
disable sensors module
.UNINDENT .UNINDENT
.INDENT 0.0 .INDENT 0.0
.TP .TP
...@@ -168,11 +103,6 @@ disable the Web UI (only the Restful API will respond) ...@@ -168,11 +103,6 @@ disable the Web UI (only the Restful API will respond)
.UNINDENT .UNINDENT
.INDENT 0.0 .INDENT 0.0
.TP .TP
.B \-\-disable\-wifi
disable Wifi module
.UNINDENT
.INDENT 0.0
.TP
.B \-\-light, \-\-enable\-light .B \-\-light, \-\-enable\-light
light mode for Curses UI (disable all but top menu) light mode for Curses UI (disable all but top menu)
.UNINDENT .UNINDENT
...@@ -233,66 +163,6 @@ enable extended stats on top process ...@@ -233,66 +163,6 @@ enable extended stats on top process
.UNINDENT .UNINDENT
.INDENT 0.0 .INDENT 0.0
.TP .TP
.B \-\-export\-graph
export stats to graph
.UNINDENT
.INDENT 0.0
.TP
.B \-\-path\-graph PATH_GRAPH
set the export path for graph history
.UNINDENT
.INDENT 0.0
.TP
.B \-\-export\-csv EXPORT_CSV
export stats to a CSV file
.UNINDENT
.INDENT 0.0
.TP
.B \-\-export\-cassandra
export stats to a Cassandra/Scylla server (cassandra lib needed)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-export\-couchdb
export stats to a CouchDB server (couchdb lib needed)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-export\-elasticsearch
export stats to an Elasticsearch server (elasticsearch lib needed)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-export\-influxdb
export stats to an InfluxDB server (influxdb lib needed)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-export\-opentsdb
export stats to an OpenTSDB server (potsdb lib needed)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-export\-rabbitmq
export stats to RabbitMQ broker (pika lib needed)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-export\-statsd
export stats to a StatsD server (statsd lib needed)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-export\-riemann
export stats to Riemann server (bernhard lib needed)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-export\-zeromq
export stats to a ZeroMQ server (zmq lib needed)
.UNINDENT
.INDENT 0.0
.TP
.B \-c CLIENT, \-\-client CLIENT .B \-c CLIENT, \-\-client CLIENT
connect to a Glances server by IPv4/IPv6 address, hostname or hostname:port connect to a Glances server by IPv4/IPv6 address, hostname or hostname:port
.UNINDENT .UNINDENT
...@@ -537,7 +407,7 @@ Show/hide current time ...@@ -537,7 +407,7 @@ Show/hide current time
.B \fBp\fP .B \fBp\fP
Sort processes by name Sort processes by name
.TP .TP
.B \fBq|ESC\fP .B \fBq|ESC|CTRL\-C\fP
Quit the current Glances session Quit the current Glances session
.TP .TP
.B \fBQ\fP .B \fBQ\fP
...@@ -723,7 +593,7 @@ an InfluxDB export module: ...@@ -723,7 +593,7 @@ an InfluxDB export module:
.nf .nf
.ft C .ft C
[influxdb] [influxdb]
# Configuration for the \-\-export\-influxdb option # Configuration for the \-\-export influxdb option
# https://influxdb.com/ # https://influxdb.com/
host=localhost host=localhost
port=8086 port=8086
...@@ -926,7 +796,7 @@ $ glances \-w ...@@ -926,7 +796,7 @@ $ glances \-w
Monitor local machine and export stats to a CSV file: Monitor local machine and export stats to a CSV file:
.INDENT 0.0 .INDENT 0.0
.INDENT 3.5 .INDENT 3.5
$ glances \-\-export\-csv $ glances \-\-export csv \-\-export\-csv\-file /tmp/glances.csv
.UNINDENT .UNINDENT
.UNINDENT .UNINDENT
.sp .sp
...@@ -935,7 +805,14 @@ refresh time (also possible to export to OpenTSDB, Cassandra, Statsd, ...@@ -935,7 +805,14 @@ refresh time (also possible to export to OpenTSDB, Cassandra, Statsd,
ElasticSearch, RabbitMQ and Riemann): ElasticSearch, RabbitMQ and Riemann):
.INDENT 0.0 .INDENT 0.0
.INDENT 3.5 .INDENT 3.5
$ glances \-t 5 \-\-export\-influxdb $ glances \-t 5 \-\-export influxdb
.UNINDENT
.UNINDENT
.sp
It is also possible to export stats to multiple endpoints:
.INDENT 0.0
.INDENT 3.5
$ glances \-t 5 \-\-export influxdb,statsd,csv
.UNINDENT .UNINDENT
.UNINDENT .UNINDENT
.sp .sp
...@@ -956,7 +833,7 @@ $ glances \-c <ip_server> ...@@ -956,7 +833,7 @@ $ glances \-c <ip_server>
Connect to a Glances server and export stats to a StatsD server: Connect to a Glances server and export stats to a StatsD server:
.INDENT 0.0 .INDENT 0.0
.INDENT 3.5 .INDENT 3.5
$ glances \-c <ip_server> \-\-export\-statsd $ glances \-c <ip_server> \-\-export statsd
.UNINDENT .UNINDENT
.UNINDENT .UNINDENT
.sp .sp
......
...@@ -285,10 +285,12 @@ class Config(object): ...@@ -285,10 +285,12 @@ class Config(object):
# Search a substring `foo` and replace it by the result of its exec # Search a substring `foo` and replace it by the result of its exec
if ret is not None: if ret is not None:
match = self.re_pattern.findall(ret) try:
for m in match: match = self.re_pattern.findall(ret)
ret = ret.replace(m, system_exec(m[1:-1])) for m in match:
ret = ret.replace(m, system_exec(m[1:-1]))
except TypeError:
pass
return ret return ret
def get_int_value(self, section, option, default=0): def get_int_value(self, section, option, default=0):
......
...@@ -37,7 +37,7 @@ class Export(GlancesExport): ...@@ -37,7 +37,7 @@ class Export(GlancesExport):
super(Export, self).__init__(config=config, args=args) super(Export, self).__init__(config=config, args=args)
# CSV file name # CSV file name
self.csv_filename = args.export_csv self.csv_filename = args.export_csv_file
# Set the CSV output file # Set the CSV output file
try: try:
...@@ -65,7 +65,7 @@ class Export(GlancesExport): ...@@ -65,7 +65,7 @@ class Export(GlancesExport):
"""Update stats in the CSV output file.""" """Update stats in the CSV output file."""
# Get the stats # Get the stats
all_stats = stats.getAllExports() all_stats = stats.getAllExports()
plugins = stats.getAllPlugins() plugins = stats.getPluginsList()
# Init data with timestamp (issue#708) # Init data with timestamp (issue#708)
if self.first_line: if self.first_line:
......
...@@ -17,7 +17,7 @@ class Export(GlancesExport): ...@@ -17,7 +17,7 @@ class Export(GlancesExport):
super(Export, self).__init__(config=config, args=args) super(Export, self).__init__(config=config, args=args)
# JSON file name # JSON file name
self.json_filename = args.export_json self.json_filename = args.export_json_file
# Set the JSON output file # Set the JSON output file
try: try:
......
...@@ -54,7 +54,7 @@ class GlancesGraph(object): ...@@ -54,7 +54,7 @@ class GlancesGraph(object):
"""Reset all the history.""" """Reset all the history."""
if not self.graph_enabled(): if not self.graph_enabled():
return False return False
for p in stats.getAllPlugins(): for p in stats.getPluginsList():
h = stats.get_plugin(p).get_stats_history() h = stats.get_plugin(p).get_stats_history()
if h is not None: if h is not None:
stats.get_plugin(p).reset_stats_history() stats.get_plugin(p).reset_stats_history()
...@@ -94,7 +94,7 @@ class GlancesGraph(object): ...@@ -94,7 +94,7 @@ class GlancesGraph(object):
return 0 return 0
index_all = 0 index_all = 0
for p in stats.getAllPlugins(): for p in stats.getPluginsList():
# History # History
h = stats.get_plugin(p).get_export_history() h = stats.get_plugin(p).get_export_history()
# Current plugin item history list # Current plugin item history list
......
...@@ -31,6 +31,16 @@ from glances.globals import LINUX, WINDOWS ...@@ -31,6 +31,16 @@ from glances.globals import LINUX, WINDOWS
from glances.logger import logger from glances.logger import logger
def disable(class_name, var):
"""Set disable_<var> to True in the class class_name."""
setattr(class_name, 'disable_' + var, True)
def enable(class_name, var):
"""Set disable_<var> to False in the class class_name."""
setattr(class_name, 'disable_' + var, False)
class GlancesMain(object): class GlancesMain(object):
"""Main class to manage Glances instance.""" """Main class to manage Glances instance."""
...@@ -54,6 +64,9 @@ Examples of use: ...@@ -54,6 +64,9 @@ Examples of use:
Monitor local machine (standalone mode): Monitor local machine (standalone mode):
$ glances $ glances
Display all Glances modules (plugins and exporters) and exit:
$ glances --module-list
Monitor local machine with the Web interface and start Restful server: Monitor local machine with the Web interface and start Restful server:
$ glances -w $ glances -w
Glances web server started on http://0.0.0.0:61208/ Glances web server started on http://0.0.0.0:61208/
...@@ -63,10 +76,10 @@ Examples of use: ...@@ -63,10 +76,10 @@ Examples of use:
Glances API available on http://0.0.0.0:61208/api/ Glances API available on http://0.0.0.0:61208/api/
Monitor local machine and export stats to a CSV file (standalone mode): Monitor local machine and export stats to a CSV file (standalone mode):
$ glances --export-csv /tmp/glances.csv $ glances --export csv --export-csv-file /tmp/glances.csv
Monitor local machine and export stats to a InfluxDB server with 5s refresh time (standalone mode): Monitor local machine and export stats to a InfluxDB server with 5s refresh time (standalone mode):
$ glances -t 5 --export-influxdb $ glances -t 5 --export influxdb
Start a Glances XML/RCP server (server mode): Start a Glances XML/RCP server (server mode):
$ glances -s $ glances -s
...@@ -75,10 +88,13 @@ Examples of use: ...@@ -75,10 +88,13 @@ Examples of use:
$ glances -c <ip_server> $ glances -c <ip_server>
Connect Glances to a Glances server and export stats to a StatsD server (client mode): Connect Glances to a Glances server and export stats to a StatsD server (client mode):
$ glances -c <ip_server> --export-statsd $ glances -c <ip_server> --export statsd
Start the client browser (browser mode): Start the client browser (browser mode):
$ glances --browser $ glances --browser
Disable some plugins (any modes):
$ glances --disable-plugin network,ports
""" """
def __init__(self): def __init__(self):
...@@ -100,51 +116,18 @@ Examples of use: ...@@ -100,51 +116,18 @@ Examples of use:
dest='debug', help='enable debug mode') dest='debug', help='enable debug mode')
parser.add_argument('-C', '--config', dest='conf_file', parser.add_argument('-C', '--config', dest='conf_file',
help='path to the configuration file') help='path to the configuration file')
# Enable or disable option on startup # Disable plugin
parser.add_argument('--disable-alert', action='store_true', default=False, parser.add_argument('--modules-list', '--module-list',
dest='disable_alert', help='disable alert module') action='store_true', default=False,
parser.add_argument('--disable-amps', action='store_true', default=False, dest='modules_list',
dest='disable_amps', help='disable applications monitoring process (AMP) module') help='display modules (plugins & exports) list and exit')
parser.add_argument('--disable-cloud', action='store_true', default=False, parser.add_argument('--disable-plugin', dest='disable_plugin',
dest='disable_cloud', help='disable Cloud module') help='disable plugin (comma separed list)')
parser.add_argument('--disable-cpu', action='store_true', default=False,
dest='disable_cpu', help='disable CPU module')
parser.add_argument('--disable-diskio', action='store_true', default=False,
dest='disable_diskio', help='disable disk I/O module')
parser.add_argument('--disable-docker', action='store_true', default=False,
dest='disable_docker', help='disable Docker module')
parser.add_argument('--disable-folders', action='store_true', default=False,
dest='disable_folders', help='disable folder module')
parser.add_argument('--disable-fs', action='store_true', default=False,
dest='disable_fs', help='disable filesystem module')
parser.add_argument('--disable-gpu', action='store_true', default=False,
dest='disable_gpu', help='disable GPU module')
parser.add_argument('--disable-hddtemp', action='store_true', default=False,
dest='disable_hddtemp', help='disable HD temperature module')
parser.add_argument('--disable-ip', action='store_true', default=False,
dest='disable_ip', help='disable IP module')
parser.add_argument('--disable-load', action='store_true', default=False,
dest='disable_load', help='disable load module')
parser.add_argument('--disable-mem', action='store_true', default=False,
dest='disable_mem', help='disable memory module')
parser.add_argument('--disable-memswap', action='store_true', default=False,
dest='disable_memswap', help='disable memory swap module')
parser.add_argument('--disable-network', action='store_true', default=False,
dest='disable_network', help='disable network module')
parser.add_argument('--disable-now', action='store_true', default=False,
dest='disable_now', help='disable current time module')
parser.add_argument('--disable-ports', action='store_true', default=False,
dest='disable_ports', help='disable ports scanner module')
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')
parser.add_argument('--disable-raid', action='store_true', default=False, # Enable or disable option
dest='disable_raid', help='disable RAID module')
parser.add_argument('--disable-sensors', action='store_true', default=False,
dest='disable_sensors', help='disable sensors module')
parser.add_argument('--disable-webui', action='store_true', default=False, parser.add_argument('--disable-webui', action='store_true', default=False,
dest='disable_webui', help='disable the Web Interface') dest='disable_webui', help='disable the Web Interface')
parser.add_argument('--disable-wifi', action='store_true', default=False,
dest='disable_wifi', help='disable wifi module')
parser.add_argument('--light', '--enable-light', action='store_true', parser.add_argument('--light', '--enable-light', action='store_true',
default=False, dest='enable_light', default=False, dest='enable_light',
help='light mode for Curses UI (disable all but top menu)') help='light mode for Curses UI (disable all but top menu)')
...@@ -175,38 +158,21 @@ Examples of use: ...@@ -175,38 +158,21 @@ Examples of use:
parser.add_argument('--enable-process-extended', action='store_true', default=False, parser.add_argument('--enable-process-extended', action='store_true', default=False,
dest='enable_process_extended', help='enable extended stats on top process') dest='enable_process_extended', help='enable extended stats on top process')
# Export modules feature # Export modules feature
parser.add_argument('--export-graph', action='store_true', default=None, parser.add_argument('--export', dest='export',
dest='export_graph', help='export stats to graphs') help='enable export module (comma separed list)')
parser.add_argument('--path-graph', default=tempfile.gettempdir(), # To be removed on https://github.com/nicolargo/glances/issues/1206
dest='path_graph', help='set the export path for graphs (default is {})'.format(tempfile.gettempdir())) # parser.add_argument('--export-graph', action='store_true', default=None,
parser.add_argument('--export-csv', default=None, # dest='export_graph', help='export stats to graphs')
dest='export_csv', help='export stats to a CSV file') # parser.add_argument('--path-graph', default=tempfile.gettempdir(),
parser.add_argument('--export-json', default=None, # dest='path_graph', help='set the export path for graphs (default is {})'.format(tempfile.gettempdir()))
dest='export_json', help='export stats to a JSON file') parser.add_argument('--export-csv-file',
parser.add_argument('--export-cassandra', action='store_true', default=False, default='./glances.csv',
dest='export_cassandra', help='export stats to a Cassandra or Scylla server (cassandra lib needed)') dest='export_csv_file',
parser.add_argument('--export-couchdb', action='store_true', default=False, help='file path for CSV exporter')
dest='export_couchdb', help='export stats to a CouchDB server (couch lib needed)') parser.add_argument('--export-json-file',
parser.add_argument('--export-elasticsearch', action='store_true', default=False, default='./glances.json',
dest='export_elasticsearch', help='export stats to an ElasticSearch server (elasticsearch lib needed)') dest='export_json_file',
parser.add_argument('--export-influxdb', action='store_true', default=False, help='file path for JSON exporter')
dest='export_influxdb', help='export stats to an InfluxDB server (influxdb lib needed)')
parser.add_argument('--export-kafka', action='store_true', default=False,
dest='export_kafka', help='export stats to a Kafka server (kafka-python lib needed)')
parser.add_argument('--export-opentsdb', action='store_true', default=False,
dest='export_opentsdb', help='export stats to an OpenTSDB server (potsdb lib needed)')
parser.add_argument('--export-prometheus', action='store_true', default=False,
dest='export_prometheus', help='export stats to a Prometheus exporter (prometheus_client lib needed)')
parser.add_argument('--export-rabbitmq', action='store_true', default=False,
dest='export_rabbitmq', help='export stats to rabbitmq broker (pika lib needed)')
parser.add_argument('--export-restful', action='store_true', default=False,
dest='export_restful', help='export stats to a Restful endpoint (requests lib needed)')
parser.add_argument('--export-riemann', action='store_true', default=False,
dest='export_riemann', help='export stats to riemann broker (bernhard lib needed)')
parser.add_argument('--export-statsd', action='store_true', default=False,
dest='export_statsd', help='export stats to a StatsD server (statsd lib needed)')
parser.add_argument('--export-zeromq', action='store_true', default=False,
dest='export_zeromq', help='export stats to a ZeroMQ server (pyzmq lib needed)')
# Client/Server option # Client/Server option
parser.add_argument('-c', '--client', dest='client', parser.add_argument('-c', '--client', dest='client',
help='connect to a Glances server by IPv4/IPv6 address or hostname') help='connect to a Glances server by IPv4/IPv6 address or hostname')
...@@ -286,6 +252,16 @@ Examples of use: ...@@ -286,6 +252,16 @@ Examples of use:
from logging import DEBUG from logging import DEBUG
logger.setLevel(DEBUG) logger.setLevel(DEBUG)
# Plugins disable/enable
if args.disable_plugin is not None:
for p in args.disable_plugin.split(','):
disable(args, p)
# Exporters activation
if args.export is not None:
for p in args.export.split(','):
setattr(args, 'export_' + p, True)
# Client/server Port # Client/server Port
if args.port is None: if args.port is None:
if args.webserver: if args.webserver:
...@@ -362,34 +338,34 @@ Examples of use: ...@@ -362,34 +338,34 @@ Examples of use:
if args.enable_light: if args.enable_light:
logger.info("Light mode is on") logger.info("Light mode is on")
args.disable_left_sidebar = True args.disable_left_sidebar = True
args.disable_process = True disable(args, 'process')
args.disable_alert = True disable(args, 'alert')
args.disable_amps = True disable(args, 'amps')
args.disable_docker = True disable(args, 'docker')
# Manage full quicklook option # Manage full quicklook option
if args.full_quicklook: if args.full_quicklook:
logger.info("Disable QuickLook menu") logger.info("Full quicklook mode")
args.disable_quicklook = False enable(args, 'quicklook')
args.disable_cpu = True disable(args, 'cpu')
args.disable_mem = True disable(args, 'mem')
args.disable_memswap = True disable(args, 'memswap')
args.disable_load = False enable(args, 'load')
# Manage disable_top option # Manage disable_top option
if args.disable_top: if args.disable_top:
logger.info("Disable top menu") logger.info("Disable top menu")
args.disable_quicklook = True disable(args, 'quicklook')
args.disable_cpu = True disable(args, 'cpu')
args.disable_mem = True disable(args, 'mem')
args.disable_memswap = True disable(args, 'memswap')
args.disable_load = True disable(args, 'load')
# Control parameter and exit if it is not OK # Control parameter and exit if it is not OK
self.args = args self.args = args
# Export is only available in standalone or client mode (issue #614) # Export is only available in standalone or client mode (issue #614)
export_tag = any([getattr(args, a) for a in args.__dict__ if a.startswith('export_')]) export_tag = self.args.export is not None and any(self.args.export)
if WINDOWS and export_tag: if WINDOWS and export_tag:
# On Windows, export is possible but only in quiet mode # On Windows, export is possible but only in quiet mode
# See issue #1038 # See issue #1038
...@@ -407,21 +383,21 @@ Examples of use: ...@@ -407,21 +383,21 @@ Examples of use:
sys.exit(2) sys.exit(2)
# Check graph output path # Check graph output path
if args.export_graph and args.path_graph is not None: # To be removed on https://github.com/nicolargo/glances/issues/1206
if not os.access(args.path_graph, os.W_OK): # if args.export_graph and args.path_graph is not None:
logger.critical("Graphs output path {} doesn't exist or is not writable".format(args.path_graph)) # if not os.access(args.path_graph, os.W_OK):
sys.exit(2) # logger.critical("Graphs output path {} doesn't exist or is not writable".format(args.path_graph))
logger.debug( # sys.exit(2)
"Graphs output path is set to {}".format(args.path_graph)) # logger.debug(
# "Graphs output path is set to {}".format(args.path_graph))
# For export graph, history is mandatory # For export graph, history is mandatory
if args.export_graph and args.disable_history: # if args.export_graph and args.disable_history:
logger.critical("Can not export graph if history is disabled") # logger.critical("Can not export graph if history is disabled")
sys.exit(2) # sys.exit(2)
# Disable HDDTemp if sensors are disabled # Disable HDDTemp if sensors are disabled
if args.disable_sensors: if getattr(args, 'disable_sensors', False):
args.disable_hddtemp = True disable(args, 'hddtemp')
logger.debug("Sensors and HDDTemp are disabled") logger.debug("Sensors and HDDTemp are disabled")
return args return args
......
...@@ -168,7 +168,7 @@ class GlancesBottle(object): ...@@ -168,7 +168,7 @@ class GlancesBottle(object):
self.stats = stats self.stats = stats
# Init plugin list # Init plugin list
self.plugins_list = self.stats.getAllPlugins() self.plugins_list = self.stats.getPluginsList()
# Bind the Bottle TCP address/port # Bind the Bottle TCP address/port
if self.args.open_web_browser: if self.args.open_web_browser:
......
...@@ -165,15 +165,6 @@ class _GlancesCurses(object): ...@@ -165,15 +165,6 @@ class _GlancesCurses(object):
"""Init the history option.""" """Init the history option."""
self.reset_history_tag = False self.reset_history_tag = False
self.graph_tag = False
if self.args.export_graph:
logger.info('Export graphs function enabled with output path %s' %
self.args.path_graph)
from glances.exports.graph import GlancesGraph
self.glances_graph = GlancesGraph(self.args.path_graph)
if not self.glances_graph.graph_enabled():
self.args.export_graph = False
logger.error('Export graphs disabled')
def _init_cursor(self): def _init_cursor(self):
"""Init cursors.""" """Init cursors."""
...@@ -382,12 +373,13 @@ class _GlancesCurses(object): ...@@ -382,12 +373,13 @@ class _GlancesCurses(object):
# 'f' > Show/hide fs / folder stats # 'f' > Show/hide fs / folder stats
self.args.disable_fs = not self.args.disable_fs self.args.disable_fs = not self.args.disable_fs
self.args.disable_folders = not self.args.disable_folders self.args.disable_folders = not self.args.disable_folders
elif self.pressedkey == ord('g'): # To be removed on https://github.com/nicolargo/glances/issues/1206
# 'g' > Generate graph from history # elif self.pressedkey == ord('g'):
self.graph_tag = not self.graph_tag # # 'g' > Generate graph from history
elif self.pressedkey == ord('r'): # self.graph_tag = not self.graph_tag
# 'r' > Reset graph history # elif self.pressedkey == ord('r'):
self.reset_history_tag = not self.reset_history_tag # # 'r' > Reset graph history
# self.reset_history_tag = not self.reset_history_tag
elif self.pressedkey == ord('w'): elif self.pressedkey == ord('w'):
# 'w' > Delete finished warning logs # 'w' > Delete finished warning logs
glances_logs.clean() glances_logs.clean()
...@@ -494,7 +486,7 @@ class _GlancesCurses(object): ...@@ -494,7 +486,7 @@ class _GlancesCurses(object):
""" """
ret = {} ret = {}
for p in stats.getAllPlugins(enable=False): for p in stats.getPluginsList(enable=False):
if p == 'quicklook' or p == 'processlist': if p == 'quicklook' or p == 'processlist':
# processlist is done later # processlist is done later
# because we need to know how many processes could be displayed # because we need to know how many processes could be displayed
...@@ -597,25 +589,26 @@ class _GlancesCurses(object): ...@@ -597,25 +589,26 @@ class _GlancesCurses(object):
# History option # History option
# Generate history graph # Generate history graph
if self.graph_tag and self.args.export_graph: # To be removed on https://github.com/nicolargo/glances/issues/1206
self.display_popup( # if self.graph_tag and self.args.export_graph:
'Generate graphs history in {}\nPlease wait...'.format( # self.display_popup(
self.glances_graph.get_output_folder())) # 'Generate graphs history in {}\nPlease wait...'.format(
self.display_popup( # self.glances_graph.get_output_folder()))
'Generate graphs history in {}\nDone: {} graphs generated'.format( # self.display_popup(
self.glances_graph.get_output_folder(), # 'Generate graphs history in {}\nDone: {} graphs generated'.format(
self.glances_graph.generate_graph(stats))) # self.glances_graph.get_output_folder(),
elif self.reset_history_tag and self.args.export_graph: # self.glances_graph.generate_graph(stats)))
self.display_popup('Reset graph history') # elif self.reset_history_tag and self.args.export_graph:
self.glances_graph.reset(stats) # self.display_popup('Reset graph history')
elif (self.graph_tag or self.reset_history_tag) and not self.args.export_graph: # self.glances_graph.reset(stats)
try: # elif (self.graph_tag or self.reset_history_tag) and not self.args.export_graph:
self.glances_graph.graph_enabled() # try:
except Exception: # self.glances_graph.graph_enabled()
self.display_popup('Graph disabled\nEnable it using --export-graph') # except Exception:
else: # self.display_popup('Graph disabled\nEnable it using --export-graph')
self.display_popup('Graph disabled') # else:
self.graph_tag = False # self.display_popup('Graph disabled')
# self.graph_tag = False
self.reset_history_tag = False self.reset_history_tag = False
# Display edit filter popup # Display edit filter popup
......
...@@ -167,7 +167,7 @@ class Plugin(GlancesPlugin): ...@@ -167,7 +167,7 @@ class Plugin(GlancesPlugin):
ret = [] ret = []
# Only process if stats exist and display plugin enable... # Only process if stats exist and display plugin enable...
if not self.stats or args.disable_sensors: if not self.stats or self.is_disable():
return ret return ret
# Max size for the interface name # Max size for the interface name
......
...@@ -167,7 +167,7 @@ class Plugin(GlancesPlugin): ...@@ -167,7 +167,7 @@ class Plugin(GlancesPlugin):
ret = [] ret = []
# Only process if stats exist and display plugin enable... # Only process if stats exist and display plugin enable...
if not self.stats or args.disable_wifi or not wifi_tag: if not self.stats or not wifi_tag or self.is_disable():
return ret return ret
# Max size for the interface name # Max size for the interface name
......
...@@ -162,7 +162,7 @@ class GlancesInstance(object): ...@@ -162,7 +162,7 @@ class GlancesInstance(object):
def getAllPlugins(self): def getAllPlugins(self):
# Return the plugins list # Return the plugins list
return json.dumps(self.stats.getAllPlugins()) return json.dumps(self.stats.getPluginsList())
def getAllLimits(self): def getAllLimits(self):
# Return all the plugins limits # Return all the plugins limits
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
"""Manage the Glances standalone session.""" """Manage the Glances standalone session."""
import sys
from glances.globals import WINDOWS from glances.globals import WINDOWS
from glances.logger import logger from glances.logger import logger
...@@ -41,6 +42,12 @@ class GlancesStandalone(object): ...@@ -41,6 +42,12 @@ class GlancesStandalone(object):
# Init stats # Init stats
self.stats = GlancesStats(config=config, args=args) self.stats = GlancesStats(config=config, args=args)
# Modules (plugins and exporters) are loaded at this point
# Glances can display the list if asked...
if args.modules_list:
self.display_modules_list()
sys.exit(0)
# If process extended stats is disabled by user # If process extended stats is disabled by user
if not args.enable_process_extended: if not args.enable_process_extended:
logger.debug("Extended stats for top process are disabled") logger.debug("Extended stats for top process are disabled")
...@@ -85,6 +92,13 @@ class GlancesStandalone(object): ...@@ -85,6 +92,13 @@ class GlancesStandalone(object):
def quiet(self): def quiet(self):
return self._quiet return self._quiet
def display_modules_list(self):
"""Display modules list"""
print("Plugins list: {}".format(
', '.join(sorted(self.stats.getPluginsList(enable=False)))))
print("Exporters list: {}".format(
', '.join(sorted(self.stats.getExportsList(enable=False)))))
def __serve_forever(self): def __serve_forever(self):
"""Main loop for the CLI.""" """Main loop for the CLI."""
# Start a counter used to compute the time needed for # Start a counter used to compute the time needed for
......
...@@ -87,14 +87,16 @@ class GlancesStats(object): ...@@ -87,14 +87,16 @@ class GlancesStats(object):
"""Wrapper to load: plugins and export modules.""" """Wrapper to load: plugins and export modules."""
# Init the plugins dict # Init the plugins dict
# Active plugins dictionnary
self._plugins = collections.defaultdict(dict) self._plugins = collections.defaultdict(dict)
# Load the plugins # Load the plugins
self.load_plugins(args=args) self.load_plugins(args=args)
# Init the export modules dict # Init the export modules dict
# Active exporters dictionnary
self._exports = collections.defaultdict(dict) self._exports = collections.defaultdict(dict)
# All available exporters dictionnary
self._exports_all = collections.defaultdict(dict)
# Load the export modules # Load the export modules
self.load_exports(args=args) self.load_exports(args=args)
...@@ -102,7 +104,7 @@ class GlancesStats(object): ...@@ -102,7 +104,7 @@ class GlancesStats(object):
sys.path = sys_path sys.path = sys_path
def _load_plugin(self, plugin_script, args=None, config=None): def _load_plugin(self, plugin_script, args=None, config=None):
"""Load the plugin (script), init it and add to the _plugin dict""" """Load the plugin (script), init it and add to the _plugin dict."""
# The key is the plugin name # The key is the plugin name
# for example, the file glances_xxx.py # for example, the file glances_xxx.py
# generate self._plugins_list["xxx"] = ... # generate self._plugins_list["xxx"] = ...
...@@ -115,6 +117,10 @@ class GlancesStats(object): ...@@ -115,6 +117,10 @@ class GlancesStats(object):
self._plugins[name] = plugin.Plugin(args=args, config=config) self._plugins[name] = plugin.Plugin(args=args, config=config)
else: else:
self._plugins[name] = plugin.Plugin(args=args) self._plugins[name] = plugin.Plugin(args=args)
# Set the disable_<name> to False by default
setattr(self.args,
'disable_' + name,
getattr(self.args, 'disable_' + name, False))
except Exception as e: except Exception as e:
# If a plugin can not be log, display a critical message # If a plugin can not be log, display a critical message
# on the console but do not crash # on the console but do not crash
...@@ -132,46 +138,69 @@ class GlancesStats(object): ...@@ -132,46 +138,69 @@ class GlancesStats(object):
args=args, config=self.config) args=args, config=self.config)
# Log plugins list # Log plugins list
logger.debug("Available plugins list: {}".format(self.getAllPlugins())) logger.debug("Active plugins list: {}".format(self.getPluginsList()))
def load_exports(self, args=None): def load_exports(self, args=None):
"""Load all export modules in the 'exports' folder.""" """Load all export modules in the 'exports' folder."""
if args is None: if args is None:
return False return False
header = "glances_" header = "glances_"
# Transform the arguments list into a dict # Build the export module available list
# The aim is to chec if the export module should be loaded
args_var = vars(locals()['args']) args_var = vars(locals()['args'])
for item in os.listdir(exports_path): for item in os.listdir(exports_path):
export_name = os.path.basename(item)[len(header):-3].lower() export_name = os.path.basename(item)[len(header):-3].lower()
if (item.startswith(header) and if (item.startswith(header) and
item.endswith(".py") and item.endswith(".py") and
item != (header + "export.py") and item != (header + "export.py") and
item != (header + "history.py") and item != (header + "history.py")):
args_var['export_' + export_name] is not None and self._exports_all[export_name] = os.path.basename(item)[:-3]
args_var['export_' + export_name] is not False): # Set the disable_<name> to False by default
setattr(self.args,
'export_' + export_name,
getattr(self.args, 'export_' + export_name, False))
# Aim is to check if the export module should be loaded
for export_name in self._exports_all:
if getattr(self.args, 'export_' + export_name, False):
# Import the export module # Import the export module
export_module = __import__(os.path.basename(item)[:-3]) export_module = __import__(self._exports_all[export_name])
# Add the export to the dictionary # Add the export to the dictionary
# The key is the module name # The key is the module name
# for example, the file glances_xxx.py # for example, the file glances_xxx.py
# generate self._exports_list["xxx"] = ... # generate self._exports_list["xxx"] = ...
self._exports[export_name] = export_module.Export(args=args, config=self.config) self._exports[export_name] = export_module.Export(args=args,
config=self.config)
self._exports_all[export_name] = self._exports[export_name]
# Log plugins list # Log plugins list
logger.debug("Available exports modules list: {}".format(self.getExportList())) logger.debug("Active exports modules list: {}".format(self.getExportsList()))
return True return True
def getAllPlugins(self, enable=True): def getPluginsList(self, enable=True):
"""Return the enable plugins list. """Return the plugins list.
if enable is False, return the list of all the plugins"""
if enable is True, only return the active plugins (default)
if enable is False, return all the plugins
Return: list of plugin name
"""
if enable: if enable:
return [p for p in self._plugins if self._plugins[p].is_enable()] return [p for p in self._plugins if self._plugins[p].is_enable()]
else: else:
return [p for p in self._plugins] return [p for p in self._plugins]
def getExportList(self): def getExportsList(self, enable=True):
"""Return the exports modules list.""" """Return the exports list.
return [e for e in self._exports]
if enable is True, only return the active exporters (default)
if enable is False, return all the exporters
Return: list of export module name
"""
if enable:
return [e for e in self._exports]
else:
return [e for e in self._exports_all]
def load_limits(self, config=None): def load_limits(self, config=None):
"""Load the stats limits (except the one in the exclude list).""" """Load the stats limits (except the one in the exclude list)."""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册