sensu-plugins-docker 1.2.0 → 1.3.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: 481a29741da795dcebfcfaa118a632c598b59727
4
- data.tar.gz: bb15b30628a2a1ba3bf8ccab1fbb6094ee7dd2fc
3
+ metadata.gz: 4b330bfae0d9fdbb983a2bb04565ef5a1e25a226
4
+ data.tar.gz: 8edf685a414d2fb53dd5847bb1d74df843c22943
5
5
  SHA512:
6
- metadata.gz: 3ae1c762dc2e30912e8c6aa12fb9bc0ab4d1c2b377f440e9368e770bb0c16607cd854e8d5c1ec29c7c65da00d7a3734889bd426a1a19a23924e106dff7eb6948
7
- data.tar.gz: 817fe789d493e9e880bd8182a626e0e76fe926572bc86bcb7376ef41175751f4fdd66623149da465222bf14c2acf7b772c305805e58372e987d6757281630247
6
+ metadata.gz: f4b2ab0f7e86f764225e03aaa96aced833fbcf6789f75e6d240fedb5147c657db64c5ddad5c603265c3f6dd4b3d3f581b58a688ec2e534b55696017f633d5e10
7
+ data.tar.gz: e8e86d5befe88b8a368a379a1841b9d07de4715242cb9c452a8677a64815f60d625a4c5df5fc1c84d520a9298d0821084ccea755b4d18bc16e44537133cfbf83
@@ -4,6 +4,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
6
  ## [Unreleased]
7
+ ## [1.3.0] - 2017-06-04
8
+ ### Added
9
+ - metrics-docker-stats.rb: Add an option to ouput a portion of the docker
10
+ container name using by splitting on a delimiter of the users choice.
11
+
12
+ ### Fixed
13
+ - check-container.rb: Fix support for docker versions >= 1.18. The key-pair [State][Status] was replaced with [State][Running] and also logic was updated (#45)
7
14
 
8
15
  ## [1.2.0] - 2017-02-08
9
16
  ### Added
@@ -76,7 +83,8 @@ changes some options. Review your check commands before deploying this version.
76
83
  ### Added
77
84
  - initial release
78
85
 
79
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.2.0...HEAD
86
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.3.0...HEAD
87
+ [1.3.0]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.2.0...1.3.0
80
88
  [1.2.0]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.1.5...1.2.0
81
89
  [1.1.5]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.1.4...1.1.5
82
90
  [1.1.4]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.1.3...1.1.4
data/README.md CHANGED
@@ -7,10 +7,11 @@
7
7
  [![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-docker.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-docker)
8
8
 
9
9
  ## Functionality
10
+ This check supports docker versions >= 1.18. Check docker-engine API for more information
10
11
 
11
12
  ## Files
12
13
  * check-container.rb
13
- * check-container-logs.rb
14
+ * check-container-logs.rb
14
15
  * check-docker-container.rb
15
16
  * metrics-docker-container.rb
16
17
  * metrics-docker-stats.rb
@@ -22,3 +23,4 @@
22
23
  [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
23
24
 
24
25
  ## Notes
26
+ [docker-engine API](https://docs.docker.com/engine/api/v1.29/#section/Versioning)
@@ -66,8 +66,8 @@ class CheckDockerContainer < Sensu::Plugin::Check::CLI
66
66
  critical "#{config[:container]} is not running on #{config[:docker_host]}"
67
67
  end
68
68
  body = JSON.parse(response.body)
69
- container_state = body['State']['Status']
70
- if container_state == 'running'
69
+ container_running = body['State']['Running']
70
+ if container_running
71
71
  if config[:tag]
72
72
  image = body['Config']['Image']
73
73
  match = image.match(/^(?:([^\/]+)\/)?(?:([^\/]+)\/)?([^@:\/]+)(?:[@:](.+))?$/)
@@ -87,6 +87,18 @@ class DockerStatsMetrics < Sensu::Plugin::Metric::CLI::Graphite
87
87
  boolean: true,
88
88
  default: false
89
89
 
90
+ option :name_parts,
91
+ description: 'Partial names by spliting and returning at index(es). \
92
+ eg. -m 3,4 my-docker-container-process_name-b2ffdab8f1aceae85300 for process_name.b2ffdab8f1aceae85300',
93
+ short: '-m index',
94
+ long: '--match index'
95
+
96
+ option :delim,
97
+ description: 'the deliminator to use with -m',
98
+ short: '-d',
99
+ long: '--deliminator',
100
+ default: '-'
101
+
90
102
  def run
91
103
  @timestamp = Time.now.to_i
92
104
 
@@ -97,7 +109,16 @@ class DockerStatsMetrics < Sensu::Plugin::Metric::CLI::Graphite
97
109
  end
98
110
  list.each do |container|
99
111
  stats = container_stats(container)
100
- output_stats(container, stats)
112
+ if config[:name_parts]
113
+ scheme = ''
114
+ config[:name_parts].split(',').each do |key|
115
+ scheme << '.' unless scheme == ''
116
+ scheme << container.split(config[:delim])[key.to_i]
117
+ end
118
+ else
119
+ scheme = container
120
+ end
121
+ output_stats(scheme, stats)
101
122
  end
102
123
  ok
103
124
  end
@@ -137,6 +158,8 @@ class DockerStatsMetrics < Sensu::Plugin::Metric::CLI::Graphite
137
158
  @containers.each do |container|
138
159
  list << if config[:friendly_names]
139
160
  container['Names'][0].delete('/')
161
+ elsif config[:name_parts]
162
+ container['Names'][0].delete('/')
140
163
  else
141
164
  container['Id']
142
165
  end
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsDocker
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 2
4
+ MINOR = 3
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.2.0
4
+ version: 1.3.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-02-08 00:00:00.000000000 Z
11
+ date: 2017-06-04 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.rb
202
+ - check-container-logs.rb
203
203
  - metrics-docker-container.rb
204
204
  - metrics-docker-stats.rb
205
+ - check-container.rb
205
206
  - 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.8
247
+ rubygems_version: 2.6.11
248
248
  signing_key:
249
249
  specification_version: 4
250
250
  summary: Sensu plugins for docker