diff --git a/collectors/0/flume.py b/collectors/0/flume.py index c4d68f7b..d3315df7 100755 --- a/collectors/0/flume.py +++ b/collectors/0/flume.py @@ -1,19 +1,19 @@ #!/usr/bin/python -# This file is part of tcollector. -# Copyright (C) 2011-2013 The tcollector Authors. -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. This program is distributed in the hope that it -# will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser -# General Public License for more details. You should have received a copy -# of the GNU Lesser General Public License along with this program. If not, -# see . - -"""flume collector""" -# Get metrics from flume. Tested with flume-ng 1.4.0 only + +""" + flume stats collector + +Connect to flume agents over http and gather metrics +and make them suitable for OpenTSDB to consume + +Need to config flume-ng to spit out json formatted metrics over http +See http://flume.apache.org/FlumeUserGuide.html#json-reporting + +Tested with flume-ng 1.4.0 only. So far + +Based on the elastichsearch collector + +""" import errno import httplib @@ -27,23 +27,20 @@ from collectors.lib import utils -# Need to config flume-ng to spit out metrics over http -# See http://flume.apache.org/FlumeUserGuide.html#reporting-metrics-from-custom-components COLLECTION_INTERVAL = 15 # seconds DEFAULT_TIMEOUT = 10.0 # seconds FLUME_HOST = "localhost" FLUME_PORT = 34545 -# Exclude values that are not really metrics +# Exclude values that are not really metrics and totally pointless to keep track of EXCLUDE = [ 'StartTime', 'StopTime', 'Type' ] def err(msg): print >>sys.stderr, msg class FlumeError(RuntimeError): - """Exception raised if we don't get a 200 OK from Flume Monitor Server.""" - + """Exception raised if we don't get a 200 OK from Flume webserver.""" def __init__(self, resp): RuntimeError.__init__(self, str(resp)) self.resp = resp @@ -68,7 +65,7 @@ def main(argv): server.connect() except socket.error, (erno, e): if erno == errno.ECONNREFUSED: - return 13 # No Flume Monitoring Service, ask tcollector to not respawn us. + return 13 # No Flume server available, ask tcollector to not respawn us. raise if json is None: err("This collector requires the `json' Python module.")