Skip to content

Instantly share code, notes, and snippets.

@ScheerMT
Forked from leehambley/statsd.rb
Last active September 15, 2015 17:09
Show Gist options
  • Save ScheerMT/3f5ed1010b2573e5dc26 to your computer and use it in GitHub Desktop.
Save ScheerMT/3f5ed1010b2573e5dc26 to your computer and use it in GitHub Desktop.

Revisions

  1. @leehambley leehambley renamed this gist Mar 18, 2013. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion statsd → statsd.rb
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@
    ✗ cat ../smithy/bin/statsd
    #!/usr/bin/env ruby
    #
    # vim: set ft=ruby
  2. @leehambley leehambley created this gist Mar 18, 2013.
    20 changes: 20 additions & 0 deletions statsd
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    ✗ cat ../smithy/bin/statsd
    #!/usr/bin/env ruby
    #
    # vim: set ft=ruby
    #

    require 'socket'
    require 'term/ansicolor'

    include Term::ANSIColor

    $stdout.sync = true

    c = Term::ANSIColor
    s = UDPSocket.new
    s.bind(nil, 8125)
    while blob = s.recvfrom(1024)
    metric, value = blob.first.split(':')
    puts "StatsD Metric: #{c.blue(metric)} #{c.green(value)}"
    end