Created
December 16, 2013 09:03
-
-
Save fh/7984214 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'haproxy' | |
haproxy = HAProxy.read_stats '/tmp/haproxy.sock' | |
statsd = UDPSocket.new | |
haproxy.stats.each do |hi| | |
if ['BACKEND', 'FRONTEND'].include?(hi[:svname]) | |
%w(scur smax ereq econ rate hrsp_2xx hrsp_3xx hrsp_4xx hrsp_5xx).each do |statname| | |
stat = "haproxy.#{hi[:svname]}.#{hi[:pxname]}.#{statname}:#{hi[statname.to_sym]}|g" | |
statsd.send(stat,0,'127.0.0.1',8125) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment