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.
#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment