haproxystats 0.0.0 → 0.0.1
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/stats.rb +5 -5
- metadata +1 -1
data/lib/haproxystats/stats.rb
CHANGED
@@ -54,20 +54,20 @@ class HAProxyStats < HAProxySocket
|
|
54
54
|
|
55
55
|
# Return number of backend servers for +service+ that are UP
|
56
56
|
def up(service)
|
57
|
-
|
58
|
-
|
57
|
+
# Return a list of UP severs
|
58
|
+
out = Array.new
|
59
59
|
backends(service).each do |this|
|
60
60
|
if @stats[service][this]['status'] == 'UP'
|
61
|
-
|
61
|
+
out = out << this
|
62
62
|
end
|
63
63
|
end
|
64
64
|
# Return the ratio
|
65
|
-
|
65
|
+
out
|
66
66
|
end
|
67
67
|
|
68
68
|
# Return a ratio of the backend servers that are UP (between 0 and 1)
|
69
69
|
# E.g if ratio <= 0.5 then at least half of the backend servers are down
|
70
70
|
def upratio(service)
|
71
|
-
up(service).to_f / backends(service).length
|
71
|
+
up(service).length.to_f / backends(service).length
|
72
72
|
end
|
73
73
|
end
|