From 237f9fb0c9073f7378e28377734bc6bd4c5d1af7 Mon Sep 17 00:00:00 2001 From: Nicolargo Date: Tue, 30 Dec 2014 22:33:54 +0100 Subject: [PATCH] Statsd export module is Ok --- NEWS | 3 ++- README.rst | 2 +- conf/glances-test.conf | 5 +++++ conf/glances.conf | 5 +++++ glances/core/glances_main.py | 2 ++ glances/exports/glances_influxdb.py | 3 +-- man/glances.1 | 8 +++++++- setup.py | 3 ++- 8 files changed, 25 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 8cd410f4..24298846 100644 --- a/NEWS +++ b/NEWS @@ -5,7 +5,8 @@ Glances Version 2.x Version 2.X =========== - * Add a new InfluxDB export module (--export-influxdb) (issue #455) + * Add InfluxDB export module (--export-influxdb) (issue #455) + * Add Statsd export module (--export-statsd) (issue #465) * Refactor export module (CSV export option is now --export-csv). It is now possible to export stats from the Glances client (issue #463) * The Web inteface is now based on BootStarp / RWD grid (issue #417, #366 and #461) Thanks to Nicolas Hart @nclsHart * Add the RAID plugins (issue #447) diff --git a/README.rst b/README.rst index d48c8a88..54d3999b 100644 --- a/README.rst +++ b/README.rst @@ -206,7 +206,7 @@ And RTFM, always. Gateway to others services ========================== -Glances can export stats to: CSV file and/or InfluxDB server. +Glances can export stats to: CSV file, InfluxDB and Statsd server. Documentation ============= diff --git a/conf/glances-test.conf b/conf/glances-test.conf index ac75d884..0e141fe2 100644 --- a/conf/glances-test.conf +++ b/conf/glances-test.conf @@ -150,3 +150,8 @@ port=8086 user=root password=root db=glances + +[statsd] +host=localhost +port=8125 +#prefix=glances diff --git a/conf/glances.conf b/conf/glances.conf index 040af380..c8378e98 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -150,3 +150,8 @@ port=8086 user=root password=root db=glances + +[statsd] +host=localhost +port=8125 +#prefix=glances diff --git a/glances/core/glances_main.py b/glances/core/glances_main.py index cf99b073..86dac256 100644 --- a/glances/core/glances_main.py +++ b/glances/core/glances_main.py @@ -96,6 +96,8 @@ class GlancesMain(object): dest='export_csv', help=_('export stats to a CSV file')) parser.add_argument('--export-influxdb', action='store_true', default=False, dest='export_influxdb', help=_('export stats to an InfluxDB server')) + parser.add_argument('--export-statsd', action='store_true', default=False, + dest='export_statsd', help=_('export stats to a Statsd server')) # Client/Server option parser.add_argument('-c', '--client', dest='client', help=_('connect to a Glances server by IPv4/IPv6 address or hostname')) diff --git a/glances/exports/glances_influxdb.py b/glances/exports/glances_influxdb.py index 34c90dff..057fa456 100644 --- a/glances/exports/glances_influxdb.py +++ b/glances/exports/glances_influxdb.py @@ -24,7 +24,6 @@ from influxdb import InfluxDBClient, client import sys # Import Glances lib -from glances.core.glances_globals import is_py3 from glances.core.glances_logging import logger from ConfigParser import NoSectionError, NoOptionError from glances.exports.glances_export import GlancesExport @@ -35,7 +34,7 @@ class Export(GlancesExport): """This class manages the InfluxDB export module.""" def __init__(self, config=None, args=None): - """Init the CSV export IF.""" + """Init the InfluxDB export IF.""" GlancesExport.__init__(self, config=config, args=args) # Load the InfluxDB configuration file diff --git a/man/glances.1 b/man/glances.1 index f4c3edb8..a606c7c5 100644 --- a/man/glances.1 +++ b/man/glances.1 @@ -67,9 +67,15 @@ enable the history mode B \-\-path-history PATH_HISTORY set the export path for graph history .TP -.B \-\-output-csv OUTPUT_CSV +.B \-\-export-csv CSV_FILE export stats to a CSV file .TP +.B \-\-export-influxdb +export stats to an InfluxDB server +.TP +.B \-\-export-statsd +export stats to a Statsd server +.TP .B \-s, \-\-server run Glances in server mode .TP diff --git a/setup.py b/setup.py index 7bf90e85..5d78b0f0 100755 --- a/setup.py +++ b/setup.py @@ -66,7 +66,8 @@ setup( 'SNMP': ['pysnmp'], 'CHART': ['matplotlib'], 'BROWSER': ['zeroconf>=0.16', 'netifaces'], - 'RAID': ['pymdstat'] + 'RAID': ['pymdstat'], + 'EXPORT': ['influxdb', 'statsd'] }, packages=['glances'], include_package_data=True,