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 +4 -4
- data/bin/check-service.rb +18 -6
- data/lib/sensu-plugins-docker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a8018dfa539b579a08be6a2ce8bcf15af1db70b57a6b504145287036145f501
|
4
|
+
data.tar.gz: 562ea4c3bd22afe19ed43cb8f5c2a1265667c9cb6b4e68db306f4b418c72e78b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e86dde287a7e4e6b7fb57b8e2feca28a4dc5f23b48b918814e5354cb1fddddf70f9021f270b7f7f920bd050009f14f55f4e9832ca5c7621aa992c558ba86769
|
7
|
+
data.tar.gz: f8b8cef5f4ea173eea496e3d145713c29059ad42ecf9f9cfb4496ec26fe35794dfe3580ccf6553c219bb4d4cff9c7546864349a01300c3dcca8562add915688f
|
data/bin/check-service.rb
CHANGED
@@ -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[
|
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
|
-
|
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
|
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.
|
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-
|
11
|
+
date: 2019-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|