summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Burry <ben@burry.name>2014-11-01 16:19:08 -0400
committerBen Burry <ben@burry.name>2014-11-01 16:19:08 -0400
commitb54b97d8cba05fa18d9cf4313f56a30f5f313002 (patch)
tree2e0d4b8851cf2a071228943d0b77dff69404dce9
parentf73b1a38f475a455e74f9bf2cd9fb3b3a3a9e031 (diff)
parentcee5dd204ff820102d25193e9cce54a3f8b7f1f8 (diff)
downloadlogster-b54b97d8cba05fa18d9cf4313f56a30f5f313002.zip
logster-b54b97d8cba05fa18d9cf4313f56a30f5f313002.tar.gz
logster-b54b97d8cba05fa18d9cf4313f56a30f5f313002.tar.bz2
Merge pull request #70 from dataloop/master
Specify graphite output protocol (tcp or udp)
-rw-r--r--README.md3
-rwxr-xr-xbin/logster9
2 files changed, 11 insertions, 1 deletions
diff --git a/README.md b/README.md
index c3bc62e..ea7e6ed 100644
--- a/README.md
+++ b/README.md
@@ -103,6 +103,9 @@ Additional usage details can be found with the -h option:
--graphite-host=GRAPHITE_HOST
Hostname and port for Graphite collector, e.g.
graphite.example.com:2003
+ --graphite-protocol=GRAPHITE_PROTOCOL
+ Specify graphite socket protocol. Options are tcp and udp.
+ Defaults to tcp.
--statsd-host=STATSD_HOST
Hostname and port for statsd collector, e.g.
statsd.example.com:8125
diff --git a/bin/logster b/bin/logster
index d8dcc62..46ab117 100755
--- a/bin/logster
+++ b/bin/logster
@@ -87,6 +87,8 @@ cmdline.add_option('--gmetric-options', action='store',
default='-d 180 -c /etc/ganglia/gmond.conf')
cmdline.add_option('--graphite-host', action='store',
help='Hostname and port for Graphite collector, e.g. graphite.example.com:2003')
+cmdline.add_option('--graphite-protocol', action='store', default='tcp',
+ help='Specify graphite socket protocol. Options are tcp and udp. Defaults to tcp.')
cmdline.add_option('--statsd-host', action='store',
help='Hostname and port for statsd collector, e.g. statsd.example.com:8125')
cmdline.add_option('--aws-key', action='store', default=os.getenv('AWS_ACCESS_KEY_ID'),
@@ -217,7 +219,12 @@ def submit_graphite(metrics, options):
if (not options.dry_run):
host = options.graphite_host.split(':')
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+
+ if options.graphite_protocol == 'udp':
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ else:
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+
s.connect((host[0], int(host[1])))
try: