onering-report-plugins 0.0.32 → 0.0.33

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,6 +7,7 @@ haproxy = nil
7
7
 
8
8
  Dir["/etc/haproxy/*.cfg"].each do |cfg|
9
9
  haproxy ||= []
10
+ pools = {}
10
11
  cfg_data = (File.read(cfg).lines rescue [])
11
12
 
12
13
  description = (cfg_data.select{|i| i =~ /^\s* description / }.first.strip.split(' ',2).last.gsub('"','') rescue nil)
@@ -19,7 +20,7 @@ Dir["/etc/haproxy/*.cfg"].each do |cfg|
19
20
  instance = {
20
21
  :name => File.basename(cfg, '.cfg'),
21
22
  :description => description,
22
- :pools => {}
23
+ :pools => []
23
24
  }
24
25
 
25
26
  stats.read.lines.each do |line|
@@ -29,9 +30,12 @@ Dir["/etc/haproxy/*.cfg"].each do |cfg|
29
30
  line = line.split(',')
30
31
 
31
32
  begin
32
- instance[:pools][line[0]] ||= []
33
- instance[:pools][line[0]] << ({
34
- :pool => line[0],
33
+ pools[line[0]] ||= {
34
+ :name => line[0],
35
+ :services => []
36
+ }
37
+
38
+ pools[line[0]][:services] << ({
35
39
  :name => line[1],
36
40
  :queue => {
37
41
  :current => line[2].to_i,
@@ -131,6 +135,7 @@ Dir["/etc/haproxy/*.cfg"].each do |cfg|
131
135
  end
132
136
  end
133
137
 
138
+ instance[:pools] = pools.values()
134
139
  haproxy << instance
135
140
  end
136
141
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onering-report-plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.32
4
+ version: 0.0.33
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: