haproxyctl 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE CHANGED
@@ -1,7 +1,8 @@
1
1
  Copyright (C) 2010-2012
2
2
  author: Carlo Flores <github@petalphile.com>
3
3
  contributors: Scott Gonyea, John A. Barbuto, Ben Lovett,
4
- Till Klampaeckel, Erik Osterman, Martin Hald, DeniedBoarding
4
+ Till Klampaeckel, Erik Osterman, Martin Hald, DeniedBoarding,
5
+ Aaron Blew, Nick Griffiths
5
6
 
6
7
  Permission is hereby granted, free of charge, to any person obtaining
7
8
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -50,7 +50,7 @@ usage: ./haproxyctl <argument>
50
50
  prompt: toggle interactive mode with prompt
51
51
  quit: disconnect
52
52
  show info: report information about the running process
53
- show stat: report counters for each proxy and server
53
+ show stat [counter...]: report counters for each proxy and server
54
54
  show errors: report last request and response errors for each proxy
55
55
  show sess [id]: report the list of current sessions or dump this session
56
56
  get weight: report a server's current weight
@@ -221,8 +221,36 @@ Examples
221
221
  ssh,localhost,0,0,0,3,,122,54524,291662,,0,,0,0,0,0,UP,1,1,0,0,0,2144680,0,,1,7,1,,122,,2,0,,10,L4OK,,0,0,121,0,1,0,0,0,,,,0,0,
222
222
  ssh,BACKEND,0,0,0,3,0,122,54524,291662,0,0,,0,0,0,0,UP,1,1,0,,0,2144680,0,,1,7,0,,122,,1,0,,10,,,,0,121,0,1,0,0,,,,,0,0,
223
223
  </pre>
224
-
225
- ## More additions: Enables or disables a target server from every backend it appears.
224
+ ### Extends stat command to print only counters supplied as arguments
225
+ <pre>
226
+ ./haproxyctl "show stat qcur qmax"
227
+ http,FRONTEND,,
228
+ sinatra,sinatra_downoi,0,0
229
+ sinatra,sinatra_rindica,0,0
230
+ sinatra,sinatra_guinea,0,0
231
+ sinatra,BACKEND,0,0
232
+ ei,guinea,0,0
233
+ ei,belem,0,0
234
+ ei,BACKEND,0,0
235
+ drop,guinea,0,0
236
+ drop,belem,0,0
237
+ drop,BACKEND,0,0
238
+ apache,guinea,0,0
239
+ apache,belem,0,0
240
+ apache,BACKEND,0,0
241
+ static,ngnix_downoi,0,0
242
+ static,ngnix_petite,0,0
243
+ static,ngnix_rindica,0,0
244
+ static,nginx_stellatus,0,0
245
+ static,nginx_belem,0,0
246
+ static,nginx_petite,0,0
247
+ static,apache_guinea,0,0
248
+ static,BACKEND,0,0
249
+ ssh,localhost,0,0
250
+ ssh,BACKEND,0,0
251
+ </pre>
252
+
253
+ ## Enable or disable a target server from every backend it appears.
226
254
  <pre>
227
255
  ./haproxyctl "show health"
228
256
  # pxname svname status weight
@@ -306,9 +334,6 @@ Examples
306
334
  Contributors
307
335
  ------------
308
336
 
309
- Ordered by date of first contribution.
310
- [Auto-generated](http://github.com/dtrejo/node-authors) on Thu Aug 16 2012 15:45:25 GMT-0700 (PDT).
311
-
312
337
  - [flores aka `flores`](https://github.com/flores)
313
338
  - [Scott Gonyea aka `sgonyea`](https://github.com/sgonyea)
314
339
  - [Ben Lovett aka `blovett`](https://github.com/blovett)
@@ -317,6 +342,8 @@ Ordered by date of first contribution.
317
342
  - [Erik Osterman aka `osterman`](https://github.com/osterman)
318
343
  - [Martin Hald aka `mhald`](https://github.com/mhald)
319
344
  - [deniedboarding](https://github.com/deniedboarding)
345
+ - [Aaron Blew aka `blewa`](https://github.com/blewa)
346
+ - [Nick Griffiths aka `nicobrevin`](https://github.com/nicobrevin)
320
347
 
321
348
  License
322
349
  -----------------
data/bin/haproxyctl CHANGED
@@ -144,6 +144,21 @@ begin
144
144
  end
145
145
  end
146
146
  end
147
+ when /show stat (.+)/
148
+ fieldnames=$1
149
+ status=unixsock("show stat")
150
+ indices = fieldnames.split(" ").map do |name|
151
+ status.first.split(',').index(name) || begin
152
+ $stderr.puts("no such field: #{name}")
153
+ $stderr.puts(" #{status.first}")
154
+ exit 1
155
+ end
156
+ end
157
+ status[1..-1].each do |line|
158
+ row = line.split(',')
159
+ filtered = indices.map {|index| row[index] }
160
+ puts (row[0...2] + filtered).compact.join(',')
161
+ end
147
162
  when /enable all (.+)/
148
163
  servername=$1
149
164
  status=unixsock("show stat")
data/haproxyctl CHANGED
@@ -144,6 +144,21 @@ begin
144
144
  end
145
145
  end
146
146
  end
147
+ when /show stat (.+)/
148
+ fieldnames=$1
149
+ status=unixsock("show stat")
150
+ indices = fieldnames.split(" ").map do |name|
151
+ status.first.split(',').index(name) || begin
152
+ $stderr.puts("no such field: #{name}")
153
+ $stderr.puts(" #{status.first}")
154
+ exit 1
155
+ end
156
+ end
157
+ status[1..-1].each do |line|
158
+ row = line.split(',')
159
+ filtered = indices.map {|index| row[index] }
160
+ puts (row[0...2] + filtered).compact.join(',')
161
+ end
147
162
  when /enable all (.+)/
148
163
  servername=$1
149
164
  status=unixsock("show stat")
@@ -6,6 +6,7 @@
6
6
  # quick and dirty (but sometimes handy) installer.
7
7
  #
8
8
 
9
+ HAPROXYVER="1.4.23"
9
10
  STARTINGDIR=$PWD
10
11
 
11
12
  # make sure we have make, pcre and junk
@@ -30,7 +31,7 @@ fi
30
31
  # grab last stable. HAProxy's site versions nicely - these will still be here after the next update
31
32
  mkdir /usr/local/src || echo "Oops, /usr/local/src exists!"
32
33
  cd /usr/local/src || exit 2
33
- wget http://haproxy.1wt.eu/download/1.4/src/haproxy-1.4.20.tar.gz
34
+ wget http://haproxy.1wt.eu/download/1.4/src/haproxy-$HAPROXYVER.tar.gz
34
35
 
35
36
  # get rid of an existing haproxy
36
37
  if [ -e /usr/local/haproxy ]; then
@@ -38,14 +39,16 @@ if [ -e /usr/local/haproxy ]; then
38
39
  fi
39
40
 
40
41
  # check the checksum
41
- MD5CHECK=`md5sum /usr/local/src/haproxy-1.4.20.tar.gz |awk '{print $1}'`
42
- if [ "$MD5CHECK" != "0cd3b91812ff31ae09ec4ace6355e29e" ] ; then
42
+ MD5CHECK=`md5sum /usr/local/src/haproxy-$HAPROXYVER.tar.gz |awk '{print $1}'`
43
+ if [ "$MD5CHECK" != "6535d5e58037ada4b58b439cebe03c79" ] ; then
43
44
  echo -e "MD5s do not match!\nBailing.";
44
45
  exit 2;
45
46
  fi
46
47
 
47
- tar xvfz haproxy-1.4.20.tar.gz
48
- cd haproxy-1.4.20
48
+ tar xvfz haproxy-$HAPROXYVER.tar.gz
49
+ rm haproxy-$HAPROXYVER.tar.gz
50
+
51
+ cd haproxy-$HAPROXYVER
49
52
 
50
53
  if uname -a | grep x86_64 ; then
51
54
  make TARGET=linux26 CPU=x86_64 USE_PCRE=1
@@ -63,8 +66,8 @@ ln -s /usr/local/sbin/haproxy /usr/sbin/haproxy
63
66
 
64
67
  # grab carlo's haproxyctl script/init
65
68
  cd /usr/local
66
- if [ -e /usr/local/haproxy ]; then
67
- cd haproxy;
69
+ if [ -e /usr/local/haproxyctl ]; then
70
+ cd haproxyctl;
68
71
  git pull;
69
72
  else
70
73
  git clone https://github.com/flores/haproxyctl.git
@@ -38,7 +38,7 @@ module HAProxyCTL
38
38
 
39
39
  def socket
40
40
  @socket ||= begin
41
- config.match /stats socket \s*([^\s]*)/
41
+ config.match /stats\s+socket \s*([^\s]*)/
42
42
  $1 || raise("Expecting 'stats socket <UNIX_socket_path>' in #{config_path}")
43
43
  end
44
44
  end
@@ -1,3 +1,3 @@
1
1
  module HAProxyCTL
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,34 +1,28 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: haproxyctl
3
- version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 0
9
- - 0
10
- version: 1.0.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Carlo Flores
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2013-03-11 00:00:00 -07:00
19
- default_executable:
12
+ date: 2013-05-10 00:00:00.000000000 Z
20
13
  dependencies: []
21
-
22
- description: This is a simple wrapper to make life with HAProxy a little more convenient. Acts as an init script for start, stop, reload, restart, etc. Leverages 'socket' to enable and disable servers on the fly. Formats server weight and backends in a readable way. Provides Nagios and Cloudkick health checks. Compatible with RHEL chkconfig/service.
23
- email:
14
+ description: This is a simple wrapper to make life with HAProxy a little more convenient.
15
+ Acts as an init script for start, stop, reload, restart, etc. Leverages 'socket'
16
+ to enable and disable servers on the fly. Formats server weight and backends in
17
+ a readable way. Provides Nagios and Cloudkick health checks. Compatible with RHEL
18
+ chkconfig/service.
19
+ email:
24
20
  - github@petalphile.com
25
- executables:
21
+ executables:
26
22
  - haproxyctl
27
23
  extensions: []
28
-
29
24
  extra_rdoc_files: []
30
-
31
- files:
25
+ files:
32
26
  - .gitignore
33
27
  - Gemfile
34
28
  - LICENSE
@@ -59,39 +53,29 @@ files:
59
53
  - rhapr/spec/spec_helper.rb
60
54
  - rhapr/spec/support/config_fixtures.rb
61
55
  - rhapr/spec/support/custom_matchers.rb
62
- has_rdoc: true
63
56
  homepage: https://github.com/flores/haproxyctl
64
- licenses:
57
+ licenses:
65
58
  - MIT
66
59
  post_install_message:
67
60
  rdoc_options: []
68
-
69
- require_paths:
61
+ require_paths:
70
62
  - lib
71
- required_ruby_version: !ruby/object:Gem::Requirement
63
+ required_ruby_version: !ruby/object:Gem::Requirement
72
64
  none: false
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- hash: 3
77
- segments:
78
- - 0
79
- version: "0"
80
- required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
70
  none: false
82
- requirements:
83
- - - ">="
84
- - !ruby/object:Gem::Version
85
- hash: 3
86
- segments:
87
- - 0
88
- version: "0"
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
89
75
  requirements: []
90
-
91
76
  rubyforge_project: haproxyctl
92
- rubygems_version: 1.3.7
77
+ rubygems_version: 1.8.23
93
78
  signing_key:
94
79
  specification_version: 3
95
80
  summary: Wrapper to talk to the HAProxy socket, as well as regular init (start|stop|status|etc)
96
81
  test_files: []
97
-