diff options
author | Ben Burry <ben@burry.name> | 2014-11-01 16:19:08 -0400 |
---|---|---|
committer | Ben Burry <ben@burry.name> | 2014-11-01 16:19:08 -0400 |
commit | b54b97d8cba05fa18d9cf4313f56a30f5f313002 (patch) | |
tree | 2e0d4b8851cf2a071228943d0b77dff69404dce9 | |
parent | f73b1a38f475a455e74f9bf2cd9fb3b3a3a9e031 (diff) | |
parent | cee5dd204ff820102d25193e9cce54a3f8b7f1f8 (diff) | |
download | logster-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.md | 3 | ||||
-rwxr-xr-x | bin/logster | 9 |
2 files changed, 11 insertions, 1 deletions
@@ -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: |