sensu-plugins-docker 1.4.0 → 1.5.0

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: 0a0c669db204f3d8f22810459efda23ae2deb92e
4
- data.tar.gz: cc6319e61a7c19d261ab14a3c368173b6a428f60
3
+ metadata.gz: b1e2c1bb477a34e521406ffdf082d93d26e120d2
4
+ data.tar.gz: abd002d60d649ea8f027284a9a95bd3b53cdfd1d
5
5
  SHA512:
6
- metadata.gz: a8290f04f055c64d86316f0cb2a1739a26ef1b078b0384a53fae609d96aa6f93d82ab412ab1f3549d4cca7089db9ce1423d26e78bd26d9ec2261ea04a74d522a
7
- data.tar.gz: 28d541dee490616f29e48ff003aac8c77e2b849a8a3c75d7a3f21e10fd642b488e9e570c786934ce2a422cc0312d6cddeff6350adab4dca31d55c83896fbbc3c
6
+ metadata.gz: ba3beabd4ed6dc8b0bf0728b0532668bf5c5fe53d2b436d6a3a1514f1357efcb9e37c07b04ce643b40f00374ec9e9997596a97a41253828e261d676d810aeb01
7
+ data.tar.gz: 5655e96207a5063dadd89510e83fdce1c236ba4d5fa14b7f09526d47fc25c0aa448bdf6e62a61be6a9d029426f68b724dfe6572b9bfb68f56c7bf0fdf9cc7121
@@ -1,10 +1,18 @@
1
1
  # Change Log
2
2
  This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
- This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
4
+ This CHANGELOG follows the format listed at [Our CHANGELOG Guidelines ](https://github.com/sensu-plugins/community/blob/master/HOW_WE_CHANGELOG.md).
5
+ Which is based on [Keep A Changelog](http://keepachangelog.com/)
5
6
 
6
7
  ## [Unreleased]
7
8
 
9
+ ## [1.5.0] - 2017-09-09
10
+ ### Added
11
+ - metrics-docker-stats.rb: Include metric with cpu usage percentage calculated based on docker stats (@alcasim)
12
+
13
+ ### Changed
14
+ - updated CHANGELOG guidelines location (@majormoses)
15
+
8
16
  ## [1.4.0] - 2017-08-08
9
17
  ### Added
10
18
  - metrics-docker-info.rb: general information metrics from docker (@alcasim)
@@ -96,7 +104,8 @@ changes some options. Review your check commands before deploying this version.
96
104
  ### Added
97
105
  - initial release
98
106
 
99
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.4.0...HEAD
107
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.5.0...HEAD
108
+ [1.5.0]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.4.0..1.5.0
100
109
  [1.4.0]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.3.1...1.4.0
101
110
  [1.3.1]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.3.0...1.3.1
102
111
  [1.3.0]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.2.0...1.3.0
@@ -111,6 +111,13 @@ class DockerStatsMetrics < Sensu::Plugin::Metric::CLI::Graphite
111
111
  boolean: true,
112
112
  default: false
113
113
 
114
+ option :cpupercent,
115
+ description: 'add cpu usage percentage metric',
116
+ short: '-P',
117
+ long: '--percentage',
118
+ boolean: true,
119
+ default: false
120
+
114
121
  def run
115
122
  @timestamp = Time.now.to_i
116
123
 
@@ -150,6 +157,7 @@ class DockerStatsMetrics < Sensu::Plugin::Metric::CLI::Graphite
150
157
  output "#{config[:scheme]}.#{container}.#{key}", value, @timestamp
151
158
  end
152
159
  end
160
+ output "#{config[:scheme]}.#{container}.cpu_stats.usage_percent", calculate_cpu_percent(stats), @timestamp if config[:cpupercent]
153
161
  end
154
162
 
155
163
  def docker_api(path)
@@ -212,4 +220,17 @@ class DockerStatsMetrics < Sensu::Plugin::Metric::CLI::Graphite
212
220
  end
213
221
  stats_out
214
222
  end
223
+
224
+ def calculate_cpu_percent(stats)
225
+ cpu_percent = 0.0
226
+ previous_cpu = stats['precpu_stats']['cpu_usage']['total_usage']
227
+ previous_system = stats['precpu_stats']['system_cpu_usage']
228
+ cpu_delta = stats['cpu_stats']['cpu_usage']['total_usage'] - previous_cpu
229
+ system_delta = stats['cpu_stats']['system_cpu_usage'] - previous_system
230
+ if system_delta > 0 && cpu_delta > 0
231
+ number_of_cpu = stats['cpu_stats']['cpu_usage']['percpu_usage'].length
232
+ cpu_percent = (cpu_delta.to_f / system_delta.to_f) * number_of_cpu * 100
233
+ end
234
+ format('%.2f', cpu_percent)
235
+ end
215
236
  end
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsDocker
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 4
4
+ MINOR = 5
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
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.4.0
4
+ version: 1.5.0
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: 2017-08-09 00:00:00.000000000 Z
11
+ date: 2017-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docker-api
@@ -199,11 +199,11 @@ description: |-
199
199
  metrics via `docker ps`
200
200
  email: "<sensu-users@googlegroups.com>"
201
201
  executables:
202
- - check-container-logs.rb
203
202
  - metrics-docker-container.rb
204
203
  - metrics-docker-info.rb
205
- - metrics-docker-stats.rb
206
204
  - check-container.rb
205
+ - check-container-logs.rb
206
+ - metrics-docker-stats.rb
207
207
  - check-docker-container.rb
208
208
  extensions: []
209
209
  extra_rdoc_files: []
@@ -246,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
246
246
  version: '0'
247
247
  requirements: []
248
248
  rubyforge_project:
249
- rubygems_version: 2.6.11
249
+ rubygems_version: 2.6.13
250
250
  signing_key:
251
251
  specification_version: 4
252
252
  summary: Sensu plugins for docker