riemann-tools 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +2 -0
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +8 -0
  5. data/.ruby-version +1 -0
  6. data/CHANGELOG.md +25 -2
  7. data/Rakefile +10 -3
  8. data/bin/riemann-apache-status +1 -106
  9. data/bin/riemann-bench +2 -70
  10. data/bin/riemann-cloudant +1 -56
  11. data/bin/riemann-consul +1 -106
  12. data/bin/riemann-dir-files-count +1 -55
  13. data/bin/riemann-dir-space +1 -55
  14. data/bin/riemann-diskstats +1 -92
  15. data/bin/riemann-fd +2 -81
  16. data/bin/riemann-freeswitch +2 -119
  17. data/bin/riemann-haproxy +1 -58
  18. data/bin/riemann-health +0 -2
  19. data/bin/riemann-kvminstance +2 -22
  20. data/bin/riemann-memcached +1 -37
  21. data/bin/riemann-net +0 -2
  22. data/bin/riemann-nginx-status +1 -85
  23. data/bin/riemann-ntp +0 -2
  24. data/bin/riemann-portcheck +1 -44
  25. data/bin/riemann-proc +1 -108
  26. data/bin/riemann-varnish +1 -54
  27. data/bin/riemann-wrapper +75 -0
  28. data/bin/riemann-zookeeper +1 -39
  29. data/lib/riemann/tools/apache_status.rb +107 -0
  30. data/lib/riemann/tools/bench.rb +72 -0
  31. data/lib/riemann/tools/cloudant.rb +57 -0
  32. data/lib/riemann/tools/consul_health.rb +107 -0
  33. data/lib/riemann/tools/dir_files_count.rb +56 -0
  34. data/lib/riemann/tools/dir_space.rb +56 -0
  35. data/lib/riemann/tools/diskstats.rb +94 -0
  36. data/lib/riemann/tools/fd.rb +81 -0
  37. data/lib/riemann/tools/freeswitch.rb +119 -0
  38. data/lib/riemann/tools/haproxy.rb +59 -0
  39. data/lib/riemann/tools/health.rb +150 -19
  40. data/lib/riemann/tools/kvm.rb +23 -0
  41. data/lib/riemann/tools/memcached.rb +38 -0
  42. data/lib/riemann/tools/net.rb +2 -1
  43. data/lib/riemann/tools/nginx_status.rb +86 -0
  44. data/lib/riemann/tools/ntp.rb +1 -0
  45. data/lib/riemann/tools/portcheck.rb +45 -0
  46. data/lib/riemann/tools/proc.rb +109 -0
  47. data/lib/riemann/tools/riemann_client_wrapper.rb +43 -0
  48. data/lib/riemann/tools/uptime_parser.tab.rb +323 -0
  49. data/lib/riemann/tools/varnish.rb +55 -0
  50. data/lib/riemann/tools/version.rb +1 -1
  51. data/lib/riemann/tools/zookeeper.rb +40 -0
  52. data/lib/riemann/tools.rb +2 -20
  53. data/riemann-tools.gemspec +4 -1
  54. data/tools/riemann-aws/Rakefile +6 -9
  55. data/tools/riemann-aws/bin/riemann-aws-billing +2 -87
  56. data/tools/riemann-aws/bin/riemann-aws-rds-status +2 -62
  57. data/tools/riemann-aws/bin/riemann-aws-sqs-status +2 -44
  58. data/tools/riemann-aws/bin/riemann-aws-status +2 -77
  59. data/tools/riemann-aws/bin/riemann-elb-metrics +2 -162
  60. data/tools/riemann-aws/bin/riemann-s3-list +2 -81
  61. data/tools/riemann-aws/bin/riemann-s3-status +2 -96
  62. data/tools/riemann-aws/lib/riemann/tools/aws/billing.rb +87 -0
  63. data/tools/riemann-aws/lib/riemann/tools/aws/elb_metrics.rb +163 -0
  64. data/tools/riemann-aws/lib/riemann/tools/aws/rds_status.rb +63 -0
  65. data/tools/riemann-aws/lib/riemann/tools/aws/s3_list.rb +82 -0
  66. data/tools/riemann-aws/lib/riemann/tools/aws/s3_status.rb +97 -0
  67. data/tools/riemann-aws/lib/riemann/tools/aws/sqs_status.rb +45 -0
  68. data/tools/riemann-aws/lib/riemann/tools/aws/status.rb +74 -0
  69. data/tools/riemann-chronos/Rakefile +6 -9
  70. data/tools/riemann-chronos/bin/riemann-chronos +1 -154
  71. data/tools/riemann-chronos/lib/riemann/tools/chronos.rb +157 -0
  72. data/tools/riemann-docker/Rakefile +5 -8
  73. data/tools/riemann-docker/bin/riemann-docker +2 -200
  74. data/tools/riemann-docker/lib/riemann/tools/docker.rb +200 -0
  75. data/tools/riemann-elasticsearch/Rakefile +6 -9
  76. data/tools/riemann-elasticsearch/bin/riemann-elasticsearch +1 -167
  77. data/tools/riemann-elasticsearch/lib/riemann/tools/elasticsearch.rb +170 -0
  78. data/tools/riemann-marathon/Rakefile +6 -9
  79. data/tools/riemann-marathon/bin/riemann-marathon +1 -156
  80. data/tools/riemann-marathon/lib/riemann/tools/marathon.rb +159 -0
  81. data/tools/riemann-mesos/Rakefile +6 -9
  82. data/tools/riemann-mesos/bin/riemann-mesos +1 -139
  83. data/tools/riemann-mesos/lib/riemann/tools/mesos.rb +142 -0
  84. data/tools/riemann-munin/Rakefile +5 -8
  85. data/tools/riemann-munin/bin/riemann-munin +1 -36
  86. data/tools/riemann-munin/lib/riemann/tools/munin.rb +37 -0
  87. data/tools/riemann-rabbitmq/Rakefile +6 -9
  88. data/tools/riemann-rabbitmq/bin/riemann-rabbitmq +1 -266
  89. data/tools/riemann-rabbitmq/lib/riemann/tools/rabbitmq.rb +269 -0
  90. data/tools/riemann-riak/Rakefile +5 -8
  91. data/tools/riemann-riak/bin/riemann-riak +1 -316
  92. data/tools/riemann-riak/bin/riemann-riak-keys +0 -1
  93. data/tools/riemann-riak/bin/riemann-riak-ring +0 -1
  94. data/tools/riemann-riak/lib/riemann/tools/riak.rb +317 -0
  95. metadata +57 -10
  96. data/.travis.yml +0 -31
  97. data/tools/riemann-riak/riak_status/key_count.erl +0 -13
  98. data/tools/riemann-riak/riak_status/riak_status.rb +0 -152
  99. data/tools/riemann-riak/riak_status/ringready.erl +0 -9
@@ -3,159 +3,6 @@
3
3
 
4
4
  Process.setproctitle($PROGRAM_NAME)
5
5
 
6
- require 'riemann/tools'
6
+ require 'riemann/tools/chronos'
7
7
 
8
- module Riemann
9
- module Tools
10
- class Chronos
11
- include Riemann::Tools
12
-
13
- require 'faraday'
14
- require 'json'
15
- require 'uri'
16
-
17
- opt :read_timeout, 'Faraday read timeout', type: :int, default: 2
18
- opt :open_timeout, 'Faraday open timeout', type: :int, default: 1
19
- opt :path_prefix,
20
- 'Chronos path prefix for proxied installations e.g. "chronos" for target http://localhost/chronos/metrics', default: '/'
21
- opt :chronos_host, 'Chronos host', default: 'localhost'
22
- opt :chronos_port, 'Chronos port', type: :int, default: 4400
23
-
24
- def initialize
25
- options[:interval] = 60
26
- options[:ttl] = 120
27
- end
28
-
29
- # Handles HTTP connections and GET requests safely
30
- def safe_get(uri)
31
- # Handle connection timeouts
32
- response = nil
33
- begin
34
- connection = Faraday.new(uri)
35
- response = connection.get do |req|
36
- req.options[:timeout] = options[:read_timeout]
37
- req.options[:open_timeout] = options[:open_timeout]
38
- end
39
- rescue StandardError => e
40
- report(
41
- host: uri.host,
42
- service: 'chronos health',
43
- state: 'critical',
44
- description: "HTTP connection error: #{e.class} - #{e.message}",
45
- )
46
- end
47
- response
48
- end
49
-
50
- def health_url
51
- path_prefix = options[:path_prefix]
52
- path_prefix[0] = '' if path_prefix[0] == '/'
53
- path_prefix[path_prefix.length - 1] = '' if path_prefix[path_prefix.length - 1] == '/'
54
- "http://#{options[:chronos_host]}:#{options[:chronos_port]}#{path_prefix.length.positive? ? '/' : ''}#{path_prefix}/metrics"
55
- end
56
-
57
- def jobs_url
58
- path_prefix = options[:path_prefix]
59
- path_prefix[0] = '' if path_prefix[0] == '/'
60
- path_prefix[path_prefix.length - 1] = '' if path_prefix[path_prefix.length - 1] == '/'
61
- "http://#{options[:chronos_host]}:#{options[:chronos_port]}#{path_prefix.length.positive? ? '/' : ''}#{path_prefix}/scheduler/jobs"
62
- end
63
-
64
- def tick
65
- tick_health
66
- tick_jobs
67
- end
68
-
69
- def tick_health
70
- uri = URI(health_url)
71
- response = safe_get(uri)
72
-
73
- return if response.nil?
74
-
75
- if response.status != 200
76
- report(
77
- host: uri.host,
78
- service: 'chronos health',
79
- state: 'critical',
80
- description: "HTTP connection error: #{response.status} - #{response.body}",
81
- )
82
- else
83
- # Assuming that a 200 will give json
84
- json = JSON.parse(response.body)
85
-
86
- report(
87
- host: uri.host,
88
- service: 'chronos health',
89
- state: 'ok',
90
- )
91
-
92
- json.each_pair do |t, d|
93
- next unless d.respond_to? :each_pair
94
-
95
- d.each_pair do |service, counters|
96
- report(
97
- host: uri.host,
98
- service: "chronos_metric #{t} #{service}",
99
- metric: 1,
100
- tags: ['metric_name'],
101
- ttl: 600,
102
- )
103
- next unless counters.respond_to? :each_pair
104
-
105
- counters.each_pair do |k, v|
106
- next unless v.is_a? Numeric
107
-
108
- report(
109
- host: uri.host,
110
- service: "chronos #{service} #{k}",
111
- metric: v,
112
- tags: ['metric', t.to_s],
113
- ttl: 600,
114
- )
115
- end
116
- end
117
- end
118
- end
119
- end
120
-
121
- def tick_jobs
122
- uri = URI(jobs_url)
123
- response = safe_get(uri)
124
-
125
- return if response.nil?
126
-
127
- if response.status != 200
128
- report(
129
- host: uri.host,
130
- service: 'chronos health',
131
- state: 'critical',
132
- description: "HTTP connection error: #{response.status} - #{response.body}",
133
- )
134
- else
135
- # Assuming that a 200 will give json
136
- json = JSON.parse(response.body)
137
-
138
- report(
139
- host: uri.host,
140
- service: 'chronos health',
141
- state: 'ok',
142
- )
143
-
144
- json.each do |job|
145
- job.each_pair do |k, v|
146
- next unless v.is_a? Numeric
147
-
148
- report(
149
- host: uri.host,
150
- service: "chronos job #{job['name']} #{k}",
151
- metric: v,
152
- ttl: 120,
153
- )
154
- end
155
- end
156
- end
157
- end
158
- end
159
- end
160
- end
161
8
  Riemann::Tools::Chronos.run
@@ -0,0 +1,157 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'riemann/tools'
4
+
5
+ module Riemann
6
+ module Tools
7
+ class Chronos
8
+ include Riemann::Tools
9
+
10
+ require 'faraday'
11
+ require 'json'
12
+ require 'uri'
13
+
14
+ opt :read_timeout, 'Faraday read timeout', type: :int, default: 2
15
+ opt :open_timeout, 'Faraday open timeout', type: :int, default: 1
16
+ opt :path_prefix,
17
+ 'Chronos path prefix for proxied installations e.g. "chronos" for target http://localhost/chronos/metrics', default: '/'.dup
18
+ opt :chronos_host, 'Chronos host', default: 'localhost'
19
+ opt :chronos_port, 'Chronos port', type: :int, default: 4400
20
+
21
+ def initialize
22
+ options[:interval] = 60
23
+ options[:ttl] = 120
24
+ end
25
+
26
+ # Handles HTTP connections and GET requests safely
27
+ def safe_get(uri)
28
+ # Handle connection timeouts
29
+ response = nil
30
+ begin
31
+ connection = Faraday.new(uri)
32
+ response = connection.get do |req|
33
+ req.options[:timeout] = options[:read_timeout]
34
+ req.options[:open_timeout] = options[:open_timeout]
35
+ end
36
+ rescue StandardError => e
37
+ report(
38
+ host: uri.host,
39
+ service: 'chronos health',
40
+ state: 'critical',
41
+ description: "HTTP connection error: #{e.class} - #{e.message}",
42
+ )
43
+ end
44
+ response
45
+ end
46
+
47
+ def health_url
48
+ path_prefix = options[:path_prefix]
49
+ path_prefix[0] = '' if path_prefix[0] == '/'
50
+ path_prefix[path_prefix.length - 1] = '' if path_prefix[path_prefix.length - 1] == '/'
51
+ "http://#{options[:chronos_host]}:#{options[:chronos_port]}#{path_prefix.length.positive? ? '/' : ''}#{path_prefix}/metrics"
52
+ end
53
+
54
+ def jobs_url
55
+ path_prefix = options[:path_prefix]
56
+ path_prefix[0] = '' if path_prefix[0] == '/'
57
+ path_prefix[path_prefix.length - 1] = '' if path_prefix[path_prefix.length - 1] == '/'
58
+ "http://#{options[:chronos_host]}:#{options[:chronos_port]}#{path_prefix.length.positive? ? '/' : ''}#{path_prefix}/scheduler/jobs"
59
+ end
60
+
61
+ def tick
62
+ tick_health
63
+ tick_jobs
64
+ end
65
+
66
+ def tick_health
67
+ uri = URI(health_url)
68
+ response = safe_get(uri)
69
+
70
+ return if response.nil?
71
+
72
+ if response.status != 200
73
+ report(
74
+ host: uri.host,
75
+ service: 'chronos health',
76
+ state: 'critical',
77
+ description: "HTTP connection error: #{response.status} - #{response.body}",
78
+ )
79
+ else
80
+ # Assuming that a 200 will give json
81
+ json = JSON.parse(response.body)
82
+
83
+ report(
84
+ host: uri.host,
85
+ service: 'chronos health',
86
+ state: 'ok',
87
+ )
88
+
89
+ json.each_pair do |t, d|
90
+ next unless d.respond_to? :each_pair
91
+
92
+ d.each_pair do |service, counters|
93
+ report(
94
+ host: uri.host,
95
+ service: "chronos_metric #{t} #{service}",
96
+ metric: 1,
97
+ tags: ['metric_name'],
98
+ ttl: 600,
99
+ )
100
+ next unless counters.respond_to? :each_pair
101
+
102
+ counters.each_pair do |k, v|
103
+ next unless v.is_a? Numeric
104
+
105
+ report(
106
+ host: uri.host,
107
+ service: "chronos #{service} #{k}",
108
+ metric: v,
109
+ tags: ['metric', t.to_s],
110
+ ttl: 600,
111
+ )
112
+ end
113
+ end
114
+ end
115
+ end
116
+ end
117
+
118
+ def tick_jobs
119
+ uri = URI(jobs_url)
120
+ response = safe_get(uri)
121
+
122
+ return if response.nil?
123
+
124
+ if response.status != 200
125
+ report(
126
+ host: uri.host,
127
+ service: 'chronos health',
128
+ state: 'critical',
129
+ description: "HTTP connection error: #{response.status} - #{response.body}",
130
+ )
131
+ else
132
+ # Assuming that a 200 will give json
133
+ json = JSON.parse(response.body)
134
+
135
+ report(
136
+ host: uri.host,
137
+ service: 'chronos health',
138
+ state: 'ok',
139
+ )
140
+
141
+ json.each do |job|
142
+ job.each_pair do |k, v|
143
+ next unless v.is_a? Numeric
144
+
145
+ report(
146
+ host: uri.host,
147
+ service: "chronos job #{job['name']} #{k}",
148
+ metric: v,
149
+ ttl: 120,
150
+ )
151
+ end
152
+ end
153
+ end
154
+ end
155
+ end
156
+ end
157
+ end
@@ -11,10 +11,8 @@ ENV['COPYFILE_DISABLE'] = 'true'
11
11
 
12
12
  # Gemspec
13
13
  gemspec = Gem::Specification.new do |s|
14
- s.rubyforge_project = 'riemann-docker'
15
-
16
14
  s.name = 'riemann-docker'
17
- s.version = '0.1.3'
15
+ s.version = '0.1.5'
18
16
  s.author = 'Shani Elharrar'
19
17
  s.email = ''
20
18
  s.homepage = 'https://github.com/riemann/riemann-tools'
@@ -22,14 +20,13 @@ gemspec = Gem::Specification.new do |s|
22
20
  s.summary = 'Submits Docker container stats to riemann.'
23
21
  s.license = 'MIT'
24
22
 
25
- s.add_dependency 'riemann-tools', '>= 0.2.13'
26
- s.add_dependency 'docker-api', '>= 1.22.0'
23
+ s.add_runtime_dependency 'riemann-tools', '~> 1.0', '>= 1.1.1'
24
+ s.add_runtime_dependency 'docker-api', '~> 1.22', '>= 1.22.0'
27
25
 
28
- s.files = FileList['bin/*', 'LICENSE', 'README.md'].to_a
26
+ s.files = FileList['bin/*', 'lib/**/*.rb', 'LICENSE', 'README.md'].to_a
29
27
  s.executables |= Dir.entries('bin/')
30
- s.has_rdoc = false
31
28
 
32
- s.required_ruby_version = '>= 1.8.7'
29
+ s.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
33
30
  end
34
31
 
35
32
  Gem::PackageTask.new gemspec do |p|
@@ -3,204 +3,6 @@
3
3
 
4
4
  Process.setproctitle($PROGRAM_NAME)
5
5
 
6
- # Reports current CPU, disk, load average, and memory use to riemann.
6
+ require 'riemann/tools/docker'
7
7
 
8
- require 'riemann/tools'
9
-
10
- module Riemann
11
- module Tools
12
- class DockerHealth
13
- require 'docker'
14
- require 'socket'
15
- include Riemann::Tools
16
- include Docker
17
-
18
- opt :docker_host, 'Docker Container Host (see https://github.com/swipely/docker-api#host)', type: String,
19
- default: nil
20
- opt :cpu_warning, 'CPU warning threshold (fraction of total jiffies)', default: 0.9
21
- opt :cpu_critical, 'CPU critical threshold (fraction of total jiffies)', default: 0.95
22
- opt :disk_warning, 'Disk warning threshold (fraction of space used)', default: 0.9
23
- opt :disk_critical, 'Disk critical threshold (fraction of space used)', default: 0.95
24
- opt :memory_warning, 'Memory warning threshold (fraction of RAM)', default: 0.85
25
- opt :memory_critical, 'Memory critical threshold (fraction of RAM)', default: 0.95
26
- opt :host_hostname, 'Suffix of host', type: String, default: nil
27
- opt :checks, 'A list of checks to run.', type: :strings, default: %w[cpu memory disk basic]
28
-
29
- def containers
30
- Docker::Container.all
31
- end
32
-
33
- def get_container_name(container)
34
- container.json['Name'][1..]
35
- end
36
-
37
- def initialize
38
- Docker.url = opts[:docker_host] unless opts[:docker_host].nil?
39
-
40
- @hostname = opts[:host_hostname]
41
- @hostname = Socket.gethostname if @hostname.nil? || !(@hostname.is_a? String) || @hostname.empty?
42
-
43
- @cpu_coefficient = 1000 * 1000 * 1000
44
-
45
- @limits = {
46
- cpu: { critical: opts[:cpu_critical], warning: opts[:cpu_warning] },
47
- disk: { critical: opts[:disk_critical], warning: opts[:disk_warning] },
48
- memory: { critical: opts[:memory_critical], warning: opts[:memory_warning] },
49
- }
50
-
51
- @last_cpu_reads = {}
52
- @last_uptime_reads = {}
53
-
54
- opts[:checks].each do |check|
55
- case check
56
- when 'disk'
57
- @disk_enabled = true
58
- when 'cpu'
59
- @cpu_enabled = true
60
- when 'memory'
61
- @memory_enabled = true
62
- when 'basic'
63
- @basic_inspection_enabled = true
64
- end
65
- end
66
- end
67
-
68
- def alert(container, service, state, metric, description)
69
- opts = {
70
- service: service.to_s,
71
- state: state.to_s,
72
- metric: metric.to_f,
73
- description: description,
74
- }
75
-
76
- opts[:host] = if !container.nil?
77
- "#{@hostname}-#{container}"
78
- else
79
- @hostname
80
- end
81
-
82
- report(opts)
83
- end
84
-
85
- def report_pct(container, service, fraction, report = '', name = nil)
86
- return unless fraction
87
-
88
- name = service if name.nil?
89
-
90
- if fraction > @limits[service][:critical]
91
- alert container, name, :critical, fraction, "#{format('%.2f', fraction * 100)}% #{report}"
92
- elsif fraction > @limits[service][:warning]
93
- alert container, name, :warning, fraction, "#{format('%.2f', fraction * 100)}% #{report}"
94
- else
95
- alert container, name, :ok, fraction, "#{format('%.2f', fraction * 100)}% #{report}"
96
- end
97
- end
98
-
99
- def cpu(id, name, stats)
100
- current = stats['precpu_stats']['cpu_usage']['total_usage'] / stats['precpu_stats']['cpu_usage']['percpu_usage'].count
101
-
102
- unless current
103
- alert name, :cpu, :unknown, nil, 'no total usage found in docker remote api stats'
104
- return false
105
- end
106
-
107
- current_time = Time.parse(stats['read'])
108
- unless @last_cpu_reads[id].nil?
109
- last = @last_cpu_reads[id]
110
- used = (current - last[:v]) / (current_time - last[:t]) / @cpu_coefficient
111
-
112
- report_pct name, :cpu, used
113
- end
114
-
115
- @last_cpu_reads[id] = { v: current, t: current_time }
116
- end
117
-
118
- def memory(_id, name, stats)
119
- memory_stats = stats['memory_stats']
120
- usage = memory_stats['usage'].to_f
121
- total = memory_stats['limit'].to_f
122
- fraction = (usage / total)
123
-
124
- report_pct name, :memory, fraction, "#{usage} / #{total}"
125
- end
126
-
127
- def disk
128
- `df -P`.split(/\n/).each do |r|
129
- f = r.split(/\s+/)
130
- next if f[0] == 'Filesystem'
131
- next unless f[0] =~ %r{/} # Needs at least one slash in the mount path
132
-
133
- # Calculate capacity
134
- x = f[4].to_f / 100
135
- report_pct(nil, :disk, x, "#{f[3].to_i / 1024} mb left", "disk #{f[5]}")
136
- end
137
- end
138
-
139
- def basic_inspection(id, name, inspection)
140
- state = inspection['State']
141
- json_state = JSON.generate(state)
142
-
143
- running = state['Running']
144
-
145
- alert(
146
- name, 'status',
147
- running ? 'ok' : 'critical',
148
- running ? 1 : 0,
149
- json_state,
150
- )
151
-
152
- return unless running
153
-
154
- start_time = DateTime.rfc3339(state['StartedAt']).to_time.utc.to_i
155
- now = DateTime.now.to_time.utc.to_i
156
- uptime = now - start_time
157
-
158
- unless @last_uptime_reads[id].nil?
159
- last = @last_uptime_reads[id]
160
- restarted = start_time != last
161
- alert(
162
- name, 'uptime',
163
- restarted ? 'critical' : 'ok',
164
- uptime,
165
- "last 'StartedAt' measure was #{last} (#{Time.at(last).utc}), " \
166
- "now it's #{start_time} (#{Time.at(start_time).utc})",
167
- )
168
- end
169
-
170
- @last_uptime_reads[id] = start_time
171
- end
172
-
173
- def tick
174
- # Disk is the same in every container
175
- disk if @disk_enabled
176
-
177
- # Get CPU, Memory and Load of each container
178
- threads = []
179
-
180
- containers.each do |ctr|
181
- threads << Thread.new(ctr) do |container|
182
- id = container.id
183
- name = get_container_name(container)
184
-
185
- stats = Docker::Util.parse_json(container.connection.get("/containers/#{id}/stats", { stream: false }))
186
-
187
- if @basic_inspection_enabled
188
- inspection = Docker::Util.parse_json(container.connection.get("/containers/#{id}/json"))
189
- basic_inspection(id, name, inspection)
190
- end
191
- cpu(id, name, stats) if @cpu_enabled
192
- memory(id, name, stats) if @memory_enabled
193
- end
194
- end
195
-
196
- threads.each do |thread|
197
- thread.join
198
- rescue StandardError => e
199
- warn "#{e.class} #{e}\n#{e.backtrace.join "\n"}"
200
- end
201
- end
202
- end
203
- end
204
- end
205
-
206
- Riemann::Tools::DockerHealth.run
8
+ Riemann::Tools::Docker.run