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 +4 -4
- data/CHANGELOG.md +9 -1
- data/bin/metrics-docker-stats.rb +11 -28
- data/lib/sensu-plugins-docker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13e0d41ce9b79a3f6f2219724fc7b3c8b406c87e
|
4
|
+
data.tar.gz: 7253c2517084083dc67b63af02d1aad9e673763c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
data/bin/metrics-docker-stats.rb
CHANGED
@@ -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
|
-
|
117
|
-
|
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
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
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
|
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.
|
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-
|
11
|
+
date: 2016-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docker-api
|