sensu-plugins-docker-swarm 3.3.5 → 3.3.6

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
  SHA256:
3
- metadata.gz: 0c74843d5a39656183f6d06921db6657353d2965d7d6fd5faa4b8eafa04bd30e
4
- data.tar.gz: e36938112a208cffcb8bf064a62a4252486de4c072fd413476fa4f97d4580816
3
+ metadata.gz: 3a8018dfa539b579a08be6a2ce8bcf15af1db70b57a6b504145287036145f501
4
+ data.tar.gz: 562ea4c3bd22afe19ed43cb8f5c2a1265667c9cb6b4e68db306f4b418c72e78b
5
5
  SHA512:
6
- metadata.gz: 2fbc6c8e255b385de68737500284bf413bf22390eb5f1cafae23e297481c2b35fc335ea6fffd7777ff580960e75e4ede9bd65570a3061c30e921090d658db3b8
7
- data.tar.gz: 430bd8b2f0980f32ee34b48ab7b7011a05886787a2a3f918dc5d6470fb3eadaa5771c0b770e36caab02610d9ee99bfee9197b963fdd71e864111fd3bb863072e
6
+ metadata.gz: 9e86dde287a7e4e6b7fb57b8e2feca28a4dc5f23b48b918814e5354cb1fddddf70f9021f270b7f7f920bd050009f14f55f4e9832ca5c7621aa992c558ba86769
7
+ data.tar.gz: f8b8cef5f4ea173eea496e3d145713c29059ad42ecf9f9cfb4496ec26fe35794dfe3580ccf6553c219bb4d4cff9c7546864349a01300c3dcca8562add915688f
@@ -75,18 +75,30 @@ class CheckDockerService < Sensu::Plugin::Check::CLI
75
75
 
76
76
  # Pass the number of replicas the service should be running
77
77
  body = parse_json(response)
78
+
79
+ # Currently there is an outstanding issue in docker where the filter by name returns any services / tasks
80
+ # contain the name. ref - https://github.com/moby/moby/issues/32985
81
+ # Since there is no way to define an exact name filter, we iterate over the services and manually check the name
82
+ service_index = -1
83
+ body.each_with_index do |service, index|
84
+ if service['Spec']['Name'] == config[:service]
85
+ service_index = index
86
+ end
87
+ end
88
+
89
+ if service_index == -1
90
+ critical "service #{config[:service]} is not running on #{@client.uri}"
91
+ end
92
+
93
+ # Get the number of replicas that should be running
78
94
  intended_replicas = 0
79
95
  begin
80
- intended_replicas = body[0]['Spec']['Mode']['Replicated']['Replicas']
96
+ intended_replicas = body[service_index]['Spec']['Mode']['Replicated']['Replicas']
81
97
  rescue Exception => e
82
98
  critical "service #{config[:service]} is not running on #{@client.uri}, but was returned by the API"
83
99
  end
84
100
 
85
- # Currently there is an outstanding issue in docker where the filter by name returns any services / tasks
86
- # contain the name. ref - https://github.com/moby/moby/issues/32985
87
- # Since there is no way to define an exact name filter, we assume the first record returned is the exact
88
- # match and extract the ID to be used in tasks
89
- service_id = body[0]['ID']
101
+ service_id = body[service_index]['ID']
90
102
 
91
103
  # Call /tasks to get the number of running replicas (this is how `docker service ls` works)
92
104
  running_replicas = 0
@@ -2,7 +2,7 @@ module SensuPluginsDocker
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 3
5
- PATCH = 5
5
+ PATCH = 6
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-swarm
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.5
4
+ version: 3.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Veea Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-24 00:00:00.000000000 Z
11
+ date: 2019-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin