haproxystats 0.0.5 → 0.0.6
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/lib/haproxystats/socket.rb +5 -2
- data/lib/haproxystats/stats.rb +2 -0
- metadata +1 -1
data/lib/haproxystats/socket.rb
CHANGED
@@ -27,11 +27,14 @@ class HAProxySocket
|
|
27
27
|
sock.close
|
28
28
|
return out
|
29
29
|
end
|
30
|
-
|
30
|
+
if first_char
|
31
|
+
out = first_char + sock.read
|
32
|
+
end
|
31
33
|
sock.close
|
32
34
|
out
|
33
35
|
rescue Errno::EPIPE
|
34
|
-
if try_again
|
36
|
+
if try_again
|
37
|
+
sleep 0.2
|
35
38
|
sock.close
|
36
39
|
run(command, try_again=false)
|
37
40
|
else
|
data/lib/haproxystats/stats.rb
CHANGED
@@ -15,6 +15,8 @@ class HAProxyStats < HAProxySocket
|
|
15
15
|
# and put into @stats[service][server/aggregate]
|
16
16
|
def retrieve(all = false)
|
17
17
|
# run 'show stat' on the socket and iterate output
|
18
|
+
stats = run('show stat')
|
19
|
+
unless stats.respond_to?('each') then return nil end
|
18
20
|
run('show stat').each do |line|
|
19
21
|
if not defined? @headers
|
20
22
|
# First row of CSV output is our headers
|