sensu-plugins-docker 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e659758bc790607fd97fc818de58d96c425dd02c
4
- data.tar.gz: 72f2aa348fbcda0b4ad425ceb86fdc8abe113075
3
+ metadata.gz: 13e0d41ce9b79a3f6f2219724fc7b3c8b406c87e
4
+ data.tar.gz: 7253c2517084083dc67b63af02d1aad9e673763c
5
5
  SHA512:
6
- metadata.gz: a2b9f204d1985de2e26a74cd16136a3c4448ae73fcc98a804417fc0ab5411c0fc9ba1137b3ca20cff8f5f36b38a42b336fc34a92b5479f279f48a8f0cdb97898
7
- data.tar.gz: d97813329a96d0db5f459b0de92ab64e4db580be43221df83c32cfc24954c458ce5c4ba2d49ae935fc22b1b797926d0115c77b3dc179cb59991ddfac433c6a46
6
+ metadata.gz: 2f7c6e32000108b4eea041a666e315ec18eb44f019ffa70c932ab496cbbd83ef919830bac397c980af71526c1cde5e483c5885276c76cf53dcba2b815f9a865c
7
+ data.tar.gz: 39db1365fc49d39b10b50808308b0b028cf8b59a39377acf0c015d3d93d1243b5212b3a1a118fa0c10fa1e3ee05f93d89e12fd437cf14d85962e85e02f2ebf04
data/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.1.4] - 2016-11-26
9
+ ### Changed
10
+ - metrics-docker-stats.rb: Fix JSON parse error if there is more than one chunk
11
+ of response data needed to result in valid JSON because of large datasets.
12
+ (#18)
13
+
14
+ ## [1.1.3] - 2016-08-11
8
15
  ### Changed
9
16
  - dependencies: use net\_http\_unix = 0.2.2
10
17
 
@@ -61,7 +68,8 @@ changes some options. Review your check commands before deploying this version.
61
68
  ### Added
62
69
  - initial release
63
70
 
64
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.1.3...HEAD
71
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.1.4...HEAD
72
+ [1.1.4]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.1.3...1.1.4
65
73
  [1.1.3]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.1.2...1.1.3
66
74
  [1.1.2]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.1.1...1.1.2
67
75
  [1.1.1]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.1.0...1.1.1
@@ -113,35 +113,18 @@ class DockerStatsMetrics < Sensu::Plugin::Metric::CLI::Graphite
113
113
 
114
114
  def docker_api(path)
115
115
  if config[:docker_protocol] == 'unix'
116
- begin
117
- NetX::HTTPUnix.start("unix://#{config[:docker_host]}") do |http|
118
- request = Net::HTTP::Get.new "/#{path}"
119
- http.request request do |response|
120
- response.read_body do |chunk|
121
- @response = JSON.parse(chunk)
122
- http.finish
123
- end
124
- end
125
- end
126
- rescue NoMethodError
127
- # using http.finish to prematurely kill the stream causes this exception.
128
- return @response
129
- end
116
+ session = NetX::HTTPUnix.new("unix://#{config[:docker_host]}")
117
+ request = Net::HTTP::Get.new "/#{path}"
130
118
  else
131
119
  uri = URI("#{config[:docker_protocol]}://#{config[:docker_host]}/#{path}")
132
- begin
133
- Net::HTTP.start(uri.host, uri.port) do |http|
134
- request = Net::HTTP::Get.new uri.request_uri
135
- http.request request do |response|
136
- response.read_body do |chunk|
137
- @response = JSON.parse(chunk)
138
- http.finish
139
- end
140
- end
141
- end
142
- rescue NoMethodError
143
- # using http.finish to prematurely kill the stream causes this exception.
144
- return @response
120
+ session = Net::HTTP.new(uri.host, uri.port)
121
+ request = Net::HTTP::Get.new uri.request_uri
122
+ end
123
+
124
+ session.start do |http|
125
+ http.request request do |response|
126
+ response.value
127
+ return JSON.parse(response.read_body)
145
128
  end
146
129
  end
147
130
  end
@@ -162,7 +145,7 @@ class DockerStatsMetrics < Sensu::Plugin::Metric::CLI::Graphite
162
145
  end
163
146
 
164
147
  def container_stats(container)
165
- path = "containers/#{container}/stats"
148
+ path = "containers/#{container}/stats?stream=0"
166
149
  @stats = docker_api(path)
167
150
  end
168
151
  end
@@ -2,7 +2,7 @@ module SensuPluginsDocker
2
2
  module Version
3
3
  MAJOR = 1
4
4
  MINOR = 1
5
- PATCH = 3
5
+ PATCH = 4
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-docker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-11 00:00:00.000000000 Z
11
+ date: 2016-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docker-api