Add a new exporter to MongoDB time-serie #2203

pull/2260/head
nicolargo 2023-01-30 10:46:39 +01:00
parent 6876490d24
commit 30f981bd8e
7 changed files with 41 additions and 27 deletions

View File

@ -117,6 +117,7 @@ Optional dependencies:
- ``py-cpuinfo`` (for the Quicklook CPU info module) - ``py-cpuinfo`` (for the Quicklook CPU info module)
- ``pygal`` (for the graph export module) - ``pygal`` (for the graph export module)
- ``pymdstat`` (for RAID support) [Linux-only] - ``pymdstat`` (for RAID support) [Linux-only]
- ``pymongo`` (for the MongoDB export module) [Only for Python >= 3.7]
- ``pysnmp`` (for SNMP support) - ``pysnmp`` (for SNMP support)
- ``pySMART.smartx`` (for HDD Smart support) [Linux-only] - ``pySMART.smartx`` (for HDD Smart support) [Linux-only]
- ``pyzmq`` (for the ZeroMQ export module) - ``pyzmq`` (for the ZeroMQ export module)

View File

@ -584,6 +584,15 @@ db=glances
#user=root #user=root
#password=root #password=root
[mongodb]
# Configuration for the --export mongodb option
# https://www.mongodb.com
host=localhost
port=27017
db=glances
user=root
password=example
[kafka] [kafka]
# Configuration for the --export kafka option # Configuration for the --export kafka option
# http://kafka.apache.org/ # http://kafka.apache.org/

View File

@ -584,6 +584,15 @@ db=glances
#user=root #user=root
#password=root #password=root
[mongodb]
# Configuration for the --export mongodb option
# https://www.mongodb.com
host=localhost
port=27017
db=glances
user=root
password=example
[kafka] [kafka]
# Configuration for the --export kafka option # Configuration for the --export kafka option
# http://kafka.apache.org/ # http://kafka.apache.org/

View File

@ -9,42 +9,35 @@ following:
.. code-block:: ini .. code-block:: ini
[couchdb] [mongodb]
host=localhost host=localhost
port=5984 port=27017
user=root
password=root
db=glances db=glances
user=root
password=example
and run Glances with: and run Glances with:
.. code-block:: console .. code-block:: console
$ glances --export couchdb $ glances --export mongodb
Documents are stored in native ``JSON`` format. Glances adds ``"type"`` Documents are stored in native the configured database (glances by default)
and ``"time"`` entries: with one collection per plugin.
- ``type``: plugin name Example of MongoDB Document for the load stats:
- ``time``: timestamp (format: "2016-09-24T16:39:08.524828Z")
Example of Couch Document for the load stats:
.. code-block:: json .. code-block:: json
{ {
"_id": "36cbbad81453c53ef08804cb2612d5b6", _id: ObjectId('63d78ffee5528e543ce5af3a'),
"_rev": "1-382400899bec5615cabb99aa34df49fb", min1: 1.46337890625,
"min15": 0.33, min5: 1.09619140625,
"time": "2016-09-24T16:39:08.524828Z", min15: 1.07275390625,
"min5": 0.4, cpucore: 4,
"cpucore": 4, history_size: 1200,
"load_warning": 1, load_disable: 'False',
"min1": 0.5, load_careful: 0.7,
"history_size": 28800, load_warning: 1,
"load_critical": 5, load_critical: 5
"type": "load",
"load_careful": 0.7
} }
You can view the result using the CouchDB utils URL: http://127.0.0.1:5984/_utils/database.html?glances.

View File

@ -18,6 +18,7 @@ to providing stats to multiple services (see list below).
json json
kafka kafka
mqtt mqtt
mongodb
opentsdb opentsdb
prometheus prometheus
rabbitmq rabbitmq

View File

@ -22,6 +22,7 @@ potsdb
prometheus_client prometheus_client
pygal pygal
pymdstat pymdstat
pymongo; python_version >= "3.7"
pysnmp pysnmp
pySMART.smartx pySMART.smartx
python-dateutil python-dateutil

View File

@ -65,8 +65,8 @@ def get_install_extras_require():
'cloud': ['requests'], 'cloud': ['requests'],
'docker': ['docker>=2.0.0', 'python-dateutil', 'six'], 'docker': ['docker>=2.0.0', 'python-dateutil', 'six'],
'export': ['bernhard', 'cassandra-driver', 'couchdb', 'elasticsearch', 'export': ['bernhard', 'cassandra-driver', 'couchdb', 'elasticsearch',
'graphitesender', 'influxdb>=1.0.0', 'kafka-python', 'pika', 'graphitesender', 'influxdb>=1.0.0', 'kafka-python', 'pymongo',
'paho-mqtt', 'potsdb', 'prometheus_client', 'pyzmq', 'pika', 'paho-mqtt', 'potsdb', 'prometheus_client', 'pyzmq',
'statsd'], 'statsd'],
'folders': ['scandir'], # python_version<"3.5" 'folders': ['scandir'], # python_version<"3.5"
'graph': ['pygal'], 'graph': ['pygal'],