sensu-plugins-docker 1.1.0 → 1.1.1

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: 645a9f3659b23cffcf10ff781afd499f9c7d3e4a
4
- data.tar.gz: d767b667130c58182b49a838694ea20d5a6d59ae
3
+ metadata.gz: 46581d87a5a6c76cd794cc10d1df1f1586ff9805
4
+ data.tar.gz: afea81abc3af2f7a599c5251754deb89b5afd23c
5
5
  SHA512:
6
- metadata.gz: 2fba877081039b53878f84ae9a9788bf035a3545942565d3e644edc99720bde99648627a0f2cb806b800d736868dc2ec03b0e85d60435a85ab2c35350cd0437c
7
- data.tar.gz: 6badaf7ef560fb6052819500ee71cf9a35ec6d6a79a53e933836641cf6f1d0aa103bcb018af6abe42270d1a1291f67fe9849cdaaf6797aeb896462efc3e6aa4e
6
+ metadata.gz: baf23cafc166cf71d217124e3b5844aa8f8565ea579e153147f29c7213c2f390dfacc80f310566c6ddc6734dee3eab231b381643c68636d039206cf2e8811339
7
+ data.tar.gz: 29d55554d472b85e420385e7c4b64ea5dfd8e0c86a18fe02b0c92ffd395a76b9d71a656049d8277eee6a187f400ab345b34f6d133e3167349161a56c99810a2a
data/CHANGELOG.md CHANGED
@@ -5,6 +5,14 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.1.1] - 2016-06-10
9
+ ### Fixed
10
+ - metrics-docker-stats.rb: Fix error from trying to collect stats with multiple values. Stats that return array values are now excluded. (#29)
11
+
12
+ ### Changed
13
+ - improved help messages
14
+ - check-container.rb: issue a critical event if container state != running
15
+
8
16
  ## [1.1.0] - 2016-06-03
9
17
  ### Added
10
18
  - check-container-logs.rb: added `-s|--seconds-ago` option to be able to set time interval more precisely
@@ -46,7 +54,8 @@ changes some options. Review your check commands before deploying this version.
46
54
  ### Added
47
55
  - initial release
48
56
 
49
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.1.0...HEAD
57
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.1.1...HEAD
58
+ [1.1.1]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.1.0...1.1.1
50
59
  [1.1.0]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/1.0.0...1.1.0
51
60
  [1.0.0]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/0.0.4...1.0.0
52
61
  [0.0.4]: https://github.com/sensu-plugins/sensu-plugins-docker/compare/0.0.3...0.0.4
@@ -37,7 +37,7 @@ require 'sensu-plugins-docker/client_helpers'
37
37
 
38
38
  class ContainerLogChecker < Sensu::Plugin::Check::CLI
39
39
  option :docker_host,
40
- description: 'location of docker api: host:port or /path/to/docker.sock',
40
+ description: 'Docker socket to connect. TCP: "host:port" or Unix: "/path/to/docker.sock" (default: "127.0.0.1:2375")',
41
41
  short: '-H DOCKER_HOST',
42
42
  long: '--docker-host DOCKER_HOST',
43
43
  default: '127.0.0.1:2375'
@@ -46,6 +46,7 @@ class CheckDockerContainer < Sensu::Plugin::Check::CLI
46
46
  option :docker_host,
47
47
  short: '-h DOCKER_HOST',
48
48
  long: '--host DOCKER_HOST',
49
+ description: 'Docker socket to connect. TCP: "host:port" or Unix: "/path/to/docker.sock" (default: "127.0.0.1:2375")',
49
50
  default: '127.0.0.1:2375'
50
51
  option :container,
51
52
  short: '-c CONTAINER',
@@ -62,9 +63,11 @@ class CheckDockerContainer < Sensu::Plugin::Check::CLI
62
63
  critical "#{config[:container]} is not running on #{config[:docker_host]}"
63
64
  end
64
65
 
65
- container_info = JSON.parse(response.body)
66
- if container_info['State']['Status'] == 'running'
66
+ container_state = JSON.parse(response.body)['State']['Status']
67
+ if container_state == 'running'
67
68
  ok "#{config[:container]} is running on #{config[:docker_host]}."
69
+ else
70
+ critical "#{config[:container]} is #{container_state} on #{config[:docker_host]}."
68
71
  end
69
72
  rescue JSON::ParserError => e
70
73
  critical "JSON Error: #{e.inspect}"
@@ -38,6 +38,7 @@ class CheckDockerContainers < Sensu::Plugin::Check::CLI
38
38
  option :docker_host,
39
39
  short: '-h docker_host',
40
40
  long: '--host DOCKER_HOST',
41
+ description: 'Docker socket to connect. TCP: "host:port" or Unix: "/path/to/docker.sock" (default: "127.0.0.1:2375")',
41
42
  default: '127.0.0.1:2375'
42
43
 
43
44
  option :warn_over,
@@ -46,7 +46,7 @@ class DockerContainerMetrics < Sensu::Plugin::Metric::CLI::Graphite
46
46
  default: '/sys/fs/cgroup'
47
47
 
48
48
  option :docker_host,
49
- description: 'docker host',
49
+ description: 'Docker host. TCP: "tcp://host:port" or Unix: "unix:///path/to/docker.sock" (default: "tcp://127.0.1.1:2376")',
50
50
  short: '-H DOCKER_HOST',
51
51
  long: '--docker-host DOCKER_HOST',
52
52
  default: 'tcp://127.0.1.1:2376'
@@ -1,11 +1,11 @@
1
1
  #! /usr/bin/env ruby
2
2
  #
3
- # docker-container-metrics
3
+ # metrics-docker-stats
4
4
  #
5
5
  # DESCRIPTION:
6
6
  #
7
7
  # Supports the stats feature of the docker remote api ( docker server 1.5 and newer )
8
- # Currently only supports when docker is listening on tcp port.
8
+ # Supports connecting to docker remote API over Unix socket or TCP
9
9
  #
10
10
  #
11
11
  # OUTPUT:
@@ -18,7 +18,16 @@
18
18
  # gem: sensu-plugin
19
19
  #
20
20
  # USAGE:
21
- # #YELLOW
21
+ # Gather stats from all containers on a host using socket:
22
+ # metrics-docker-stats.rb -p unix -H /var/run/docker.sock
23
+ #
24
+ # Gather stats from all containers on a host using TCP:
25
+ # metrics-docker-stats.rb -p http -H localhost:2375
26
+ #
27
+ # Gather stats from a specific container using socket:
28
+ # metrics-docker-stats.rb -p unix -H /var/run/docker.sock -c 5bf1b82382eb
29
+ #
30
+ # See metrics-docker-stats.rb --help for full usage flags
22
31
  #
23
32
  # NOTES:
24
33
  #
@@ -28,7 +37,6 @@
28
37
  # for details.
29
38
  #
30
39
 
31
- require 'rubygems' if RUBY_VERSION < '1.9.0'
32
40
  require 'sensu-plugin/metric/cli'
33
41
  require 'socket'
34
42
  require 'net_http_unix'
@@ -61,7 +69,7 @@ class DockerStatsMetrics < Sensu::Plugin::Metric::CLI::Graphite
61
69
  default: ''
62
70
 
63
71
  option :docker_host,
64
- description: 'location of docker api, host:port or /path/to/docker.sock',
72
+ description: 'Docker socket to connect. TCP: "host:port" or Unix: "/path/to/docker.sock" (default: "127.0.0.1:2375")',
65
73
  short: '-H DOCKER_HOST',
66
74
  long: '--docker-host DOCKER_HOST',
67
75
  default: '127.0.0.1:2375'
@@ -98,7 +106,7 @@ class DockerStatsMetrics < Sensu::Plugin::Metric::CLI::Graphite
98
106
  dotted_stats = Hash.to_dotted_hash stats
99
107
  dotted_stats.each do |key, value|
100
108
  next if key == 'read' # unecessary timestamp
101
- next if key.start_with? 'blkio_stats' # array values, figure out later
109
+ next if value.is_a?(Array)
102
110
  output "#{config[:scheme]}.#{container}.#{key}", value, @timestamp
103
111
  end
104
112
  end
@@ -2,7 +2,7 @@ module SensuPluginsDocker
2
2
  module Version
3
3
  MAJOR = 1
4
4
  MINOR = 1
5
- PATCH = 0
5
+ PATCH = 1
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.0
4
+ version: 1.1.1
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-06-04 00:00:00.000000000 Z
11
+ date: 2016-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docker-api