sensu-plugins-docker 1.1.5 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22859b2cd9171cec6717e9d745f3f9c61b032836
4
- data.tar.gz: 73dcf2f816ea66c6639dd98df6dc6b025dcfa37d
3
+ metadata.gz: 481a29741da795dcebfcfaa118a632c598b59727
4
+ data.tar.gz: bb15b30628a2a1ba3bf8ccab1fbb6094ee7dd2fc
5
5
  SHA512:
6
- metadata.gz: 99f88d5de72110bb8f2027fcc8a35c7fe803f9c95e7e377b29a2b4aa798a17592241861e05910420736a3acbf36b047a67b120104e6c9645e347597f4016a4b2
7
- data.tar.gz: 9a9f8043a80181eb68db768f9aeeba8f7496774302a23fcb24ea7edc9f7fde70cc49ca2fd1243a9a5a5f4668a452a97ef5e82da78f0121adc452cec43a06e9d4
6
+ metadata.gz: 3ae1c762dc2e30912e8c6aa12fb9bc0ab4d1c2b377f440e9368e770bb0c16607cd854e8d5c1ec29c7c65da00d7a3734889bd426a1a19a23924e106dff7eb6948
7
+ data.tar.gz: 817fe789d493e9e880bd8182a626e0e76fe926572bc86bcb7376ef41175751f4fdd66623149da465222bf14c2acf7b772c305805e58372e987d6757281630247
@@ -5,6 +5,10 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.2.0] - 2017-02-08
9
+ ### Added
10
+ - check-container.rb: add an option to test image's tag (@obazoud)
11
+
8
12
  ## [1.1.5] - 2016-11-26
9
13
  ### Changed
10
14
  - Loosen `sensu-plugin` dependency to `~> 1.2` (#44)
@@ -72,7 +76,8 @@ changes some options. Review your check commands before deploying this version.
72
76
  ### Added
73
77
  - initial release
74
78
 
75
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.1.5...HEAD
79
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.2.0...HEAD
80
+ [1.2.0]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.1.5...1.2.0
76
81
  [1.1.5]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.1.4...1.1.5
77
82
  [1.1.4]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.1.3...1.1.4
78
83
  [1.1.3]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.1.2...1.1.3
@@ -52,6 +52,9 @@ class CheckDockerContainer < Sensu::Plugin::Check::CLI
52
52
  short: '-c CONTAINER',
53
53
  long: '--container CONTAINER',
54
54
  required: true
55
+ option :tag,
56
+ short: '-t TAG',
57
+ long: '--tag TAG'
55
58
 
56
59
  def run
57
60
  client = create_docker_client
@@ -62,9 +65,16 @@ class CheckDockerContainer < Sensu::Plugin::Check::CLI
62
65
  if response.body.include? 'no such id'
63
66
  critical "#{config[:container]} is not running on #{config[:docker_host]}"
64
67
  end
65
-
66
- container_state = JSON.parse(response.body)['State']['Status']
68
+ body = JSON.parse(response.body)
69
+ container_state = body['State']['Status']
67
70
  if container_state == 'running'
71
+ if config[:tag]
72
+ image = body['Config']['Image']
73
+ match = image.match(/^(?:([^\/]+)\/)?(?:([^\/]+)\/)?([^@:\/]+)(?:[@:](.+))?$/)
74
+ unless match && match[4] == config[:tag]
75
+ critical "#{config[:container]}'s tag is '#{match[4]}', excepting '#{config[:tag]}'"
76
+ end
77
+ end
68
78
  ok "#{config[:container]} is running on #{config[:docker_host]}."
69
79
  else
70
80
  critical "#{config[:container]} is #{container_state} on #{config[:docker_host]}."
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsDocker
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 1
5
- PATCH = 5
4
+ MINOR = 2
5
+ PATCH = 0
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.5
4
+ version: 1.2.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: 2016-11-26 00:00:00.000000000 Z
11
+ date: 2017-02-08 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
- - metrics-docker-stats.rb
203
202
  - check-container.rb
204
- - check-container-logs.rb
205
203
  - metrics-docker-container.rb
204
+ - metrics-docker-stats.rb
206
205
  - check-docker-container.rb
206
+ - check-container-logs.rb
207
207
  extensions: []
208
208
  extra_rdoc_files: []
209
209
  files:
@@ -244,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
244
  version: '0'
245
245
  requirements: []
246
246
  rubyforge_project:
247
- rubygems_version: 2.6.6
247
+ rubygems_version: 2.6.8
248
248
  signing_key:
249
249
  specification_version: 4
250
250
  summary: Sensu plugins for docker