diff --git a/README.rst b/README.rst index 53a573d0..9deffbd9 100644 --- a/README.rst +++ b/README.rst @@ -117,6 +117,7 @@ Optional dependencies: - ``py-cpuinfo`` (for the Quicklook CPU info module) - ``pygal`` (for the graph export module) - ``pymdstat`` (for RAID support) [Linux-only] +- ``pymongo`` (for the MongoDB export module) [Only for Python >= 3.7] - ``pysnmp`` (for SNMP support) - ``pySMART.smartx`` (for HDD Smart support) [Linux-only] - ``pyzmq`` (for the ZeroMQ export module) diff --git a/conf/glances.conf b/conf/glances.conf index 835b84d9..cf3a8f7d 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -584,6 +584,15 @@ db=glances #user=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] # Configuration for the --export kafka option # http://kafka.apache.org/ diff --git a/docker-compose/glances.conf b/docker-compose/glances.conf index 0ee06cbd..78cb3174 100644 --- a/docker-compose/glances.conf +++ b/docker-compose/glances.conf @@ -584,6 +584,15 @@ db=glances #user=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] # Configuration for the --export kafka option # http://kafka.apache.org/ diff --git a/docs/gw/couchdb.rst b/docs/gw/couchdb.rst index 66c547ba..3e4d92bd 100644 --- a/docs/gw/couchdb.rst +++ b/docs/gw/couchdb.rst @@ -9,42 +9,35 @@ following: .. code-block:: ini - [couchdb] + [mongodb] host=localhost - port=5984 - user=root - password=root + port=27017 db=glances + user=root + password=example and run Glances with: .. code-block:: console - $ glances --export couchdb + $ glances --export mongodb -Documents are stored in native ``JSON`` format. Glances adds ``"type"`` -and ``"time"`` entries: +Documents are stored in native the configured database (glances by default) +with one collection per plugin. -- ``type``: plugin name -- ``time``: timestamp (format: "2016-09-24T16:39:08.524828Z") - -Example of Couch Document for the load stats: +Example of MongoDB Document for the load stats: .. code-block:: json { - "_id": "36cbbad81453c53ef08804cb2612d5b6", - "_rev": "1-382400899bec5615cabb99aa34df49fb", - "min15": 0.33, - "time": "2016-09-24T16:39:08.524828Z", - "min5": 0.4, - "cpucore": 4, - "load_warning": 1, - "min1": 0.5, - "history_size": 28800, - "load_critical": 5, - "type": "load", - "load_careful": 0.7 + _id: ObjectId('63d78ffee5528e543ce5af3a'), + min1: 1.46337890625, + min5: 1.09619140625, + min15: 1.07275390625, + cpucore: 4, + history_size: 1200, + load_disable: 'False', + load_careful: 0.7, + load_warning: 1, + load_critical: 5 } - -You can view the result using the CouchDB utils URL: http://127.0.0.1:5984/_utils/database.html?glances. diff --git a/docs/gw/index.rst b/docs/gw/index.rst index 8052e744..e0b635f2 100644 --- a/docs/gw/index.rst +++ b/docs/gw/index.rst @@ -18,6 +18,7 @@ to providing stats to multiple services (see list below). json kafka mqtt + mongodb opentsdb prometheus rabbitmq diff --git a/optional-requirements.txt b/optional-requirements.txt index 867acc1f..36cacfad 100644 --- a/optional-requirements.txt +++ b/optional-requirements.txt @@ -22,6 +22,7 @@ potsdb prometheus_client pygal pymdstat +pymongo; python_version >= "3.7" pysnmp pySMART.smartx python-dateutil diff --git a/setup.py b/setup.py index a818ade1..b29bafb2 100755 --- a/setup.py +++ b/setup.py @@ -65,8 +65,8 @@ def get_install_extras_require(): 'cloud': ['requests'], 'docker': ['docker>=2.0.0', 'python-dateutil', 'six'], 'export': ['bernhard', 'cassandra-driver', 'couchdb', 'elasticsearch', - 'graphitesender', 'influxdb>=1.0.0', 'kafka-python', 'pika', - 'paho-mqtt', 'potsdb', 'prometheus_client', 'pyzmq', + 'graphitesender', 'influxdb>=1.0.0', 'kafka-python', 'pymongo', + 'pika', 'paho-mqtt', 'potsdb', 'prometheus_client', 'pyzmq', 'statsd'], 'folders': ['scandir'], # python_version<"3.5" 'graph': ['pygal'],