Sha256: 72f2ebc6ead992337780e8335a9af6ede93b2f55b52ab29cc543b5c2732d6e05

Contents?: true

Size: 1.99 KB

Versions: 18

Compression:

Stored size: 1.99 KB

Contents

#! /usr/bin/env ruby

require 'socket'

socket_file, sleep_time = ARGV
sleep_time ||= 0.1
sleep_time = sleep_time.to_f

UNIXServer.open(ARGV[0]) do |server|
  socket = server.accept
  command = socket.gets.chomp
  sleep sleep_time
  if command == "show stat"
    begin
      socket.puts <<-DATA
# pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,tracked,type,rate,rate_lim,rate_max,check_status,check_code,check_duration,hrsp_1xx,hrsp_2xx,hrsp_3xx,hrsp_4xx,hrsp_5xx,hrsp_other,hanafail,req_rate,req_rate_max,req_tot,cli_abrt,srv_abrt,
stats,FRONTEND,,,0,0,2000,0,0,0,0,0,0,,,,,OPEN,,,,,,,,,1,1,0,,,,0,0,0,0,,,,0,0,0,0,0,0,,0,0,0,,,
stats_backend,BACKEND,0,0,0,0,0,0,0,0,0,0,,0,0,0,0,UP,0,0,0,,0,35,0,,1,2,0,,0,,1,0,,0,,,,0,0,0,0,0,0,,,,,0,0,
yellow,FRONTEND,,,0,0,2000,0,0,0,0,0,0,,,,,OPEN,,,,,,,,,1,3,0,,,,0,0,0,0,,,,,,,,,,,0,0,0,,,
yellow_cluster,node1,0,0,0,0,,0,0,0,,0,,0,0,0,0,UP,1,1,0,0,1,35,35,,1,4,1,,0,,2,0,,0,L4CON,,0,,,,,,,0,,,,0,0,
yellow_cluster,node2,0,0,0,0,,0,0,0,,0,,0,0,0,0,DOWN,1,1,0,0,1,35,35,,1,4,1,,0,,2,0,,0,L4CON,,0,,,,,,,0,,,,0,0,
yellow_cluster,node3,0,0,0,0,,0,0,0,,0,,0,0,0,0,DOWN,1,1,0,0,1,34,34,,1,4,2,,0,,2,0,,0,L4CON,,0,,,,,,,0,,,,0,0,
yellow_cluster,BACKEND,0,0,0,0,0,0,0,0,0,0,,0,0,0,0,UP,0,0,0,,1,34,34,,1,4,0,,0,,1,0,,0,,,,,,,,,,,,,,0,0,
orange,FRONTEND,,,0,0,2000,0,0,0,0,0,0,,,,,OPEN,,,,,,,,,1,5,0,,,,0,0,0,0,,,,,,,,,,,0,0,0,,,
orange_cluster,orange1,0,0,0,0,,0,0,0,,0,,0,0,0,0,DOWN,1,1,0,0,0,35,0,,1,6,1,,0,,2,0,,0,L4OK,,5,,,,,,,0,,,,0,0,
orange_cluster,orange2,0,0,0,0,,0,0,0,,0,,0,0,0,0,DOWN,1,1,0,0,0,35,0,,1,6,1,,0,,2,0,,0,L4OK,,5,,,,,,,0,,,,0,0,
orange_cluster,BACKEND,0,0,0,0,0,0,0,0,0,0,,0,0,0,0,DOWN,1,1,0,,0,35,0,,1,6,0,,0,,1,0,,0,,,,,,,,,,,,,,0,0,
DATA
      socket.close
    rescue Errno::EPIPE
      # client closed the connection before we got to write
    rescue Errno::EINVAL
      # client closed connection because of timeout
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
litmus_paper-0.9.7 spec/support/haproxy_test_socket
litmus_paper-0.9.6 spec/support/haproxy_test_socket
litmus_paper-0.9.5 spec/support/haproxy_test_socket
litmus_paper-0.9.4 spec/support/haproxy_test_socket
litmus_paper-0.9.3 spec/support/haproxy_test_socket
litmus_paper-0.9.2 spec/support/haproxy_test_socket
litmus_paper-0.9.1 spec/support/haproxy_test_socket
litmus_paper-0.9.0 spec/support/haproxy_test_socket
litmus_paper-0.8.9 spec/support/haproxy_test_socket
litmus_paper-0.8.8 spec/support/haproxy_test_socket
litmus_paper-0.8.7 spec/support/haproxy_test_socket
litmus_paper-0.8.6 spec/support/haproxy_test_socket
litmus_paper-0.8.5 spec/support/haproxy_test_socket
litmus_paper-0.8.4 spec/support/haproxy_test_socket
litmus_paper-0.8.3 spec/support/haproxy_test_socket
litmus_paper-0.8.2 spec/support/haproxy_test_socket
litmus_paper-0.8.1 spec/support/haproxy_test_socket
litmus_paper-0.8.0 spec/support/haproxy_test_socket