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.
Files changed (2) hide show
  1. data/lib/haproxystats/stats.rb +5 -5
  2. metadata +1 -1
@@ -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
- up_count = 0
58
- # iterate servers and count the UPs
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
- up_count += 1
61
+ out = out << this
62
62
  end
63
63
  end
64
64
  # Return the ratio
65
- up_count
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haproxystats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: