sensu-plugins-edgelab 1.6.4 → 1.7.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 +4 -4
- data/bin/check-consul-services.rb +54 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8d408e0d47d404407c8797de17c7d5a6698fb1a
|
4
|
+
data.tar.gz: 577f551871f325099a0450dbd1b93584e02d21ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32a945c2623379e0a24d21b304acdd3083eeaa7c1453f3c2c9bb48b9de3b4e1b1fea962ade3136cfde07d716c5e08496e5ecc7110e9d1283d7450f5b22d4ad4e
|
7
|
+
data.tar.gz: 05f39a9150b3ec536db4ee3bfc16e24c2c1fe40afca48dd3f08062ee4918509704f6ffa9400be42352062893b021c22ffdee04cffdc500e92bd29441c021f24e
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# check-consul-services
|
4
|
+
#
|
5
|
+
# DESCRIPTION:
|
6
|
+
# Check the status of the services registered in Consul.
|
7
|
+
#
|
8
|
+
# OUTPUT:
|
9
|
+
# plain text
|
10
|
+
#
|
11
|
+
# PLATFORMS:
|
12
|
+
# Linux
|
13
|
+
#
|
14
|
+
# DEPENDENCIES:
|
15
|
+
# gem: sensu-plugin
|
16
|
+
# gem: diplomat
|
17
|
+
#
|
18
|
+
# USAGE:
|
19
|
+
# ./check-consul-services
|
20
|
+
#
|
21
|
+
# NOTES:
|
22
|
+
#
|
23
|
+
# LICENSE:
|
24
|
+
# Copyright 2017 Jonathan Ballet <jballet@edgelab.ch>
|
25
|
+
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
26
|
+
# for details.
|
27
|
+
#
|
28
|
+
|
29
|
+
require 'sensu-plugin/check/cli'
|
30
|
+
require 'diplomat'
|
31
|
+
|
32
|
+
class CheckConsulServiceS < Sensu::Plugin::Check::CLI
|
33
|
+
option :consul,
|
34
|
+
description: 'consul server',
|
35
|
+
long: '--consul SERVER',
|
36
|
+
default: 'http://localhost:8500'
|
37
|
+
|
38
|
+
def run
|
39
|
+
Diplomat.configure do |dc|
|
40
|
+
dc.url = config[:consul]
|
41
|
+
end
|
42
|
+
|
43
|
+
results = []
|
44
|
+
|
45
|
+
# Process all of the nonpassing service checks
|
46
|
+
Diplomat::Health.state('any').each do |s|
|
47
|
+
next if s['Status'] == 'passing'
|
48
|
+
results.push "#{s['ServiceName']} on #{s['Node']}"
|
49
|
+
end
|
50
|
+
|
51
|
+
critical results.join(', ') unless results.empty?
|
52
|
+
ok
|
53
|
+
end
|
54
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-edgelab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edgelab
|
@@ -156,6 +156,7 @@ executables:
|
|
156
156
|
- check-nomad-leader.rb
|
157
157
|
- metrics-redis-key-pattern.rb
|
158
158
|
- metrics-aws-asg.rb
|
159
|
+
- check-consul-services.rb
|
159
160
|
- metrics-aws-elb.rb
|
160
161
|
- metrics-aws-rds.rb
|
161
162
|
- metrics-mysql-processes.rb
|
@@ -167,6 +168,7 @@ extensions: []
|
|
167
168
|
extra_rdoc_files: []
|
168
169
|
files:
|
169
170
|
- bin/check-apt-expired-keys.rb
|
171
|
+
- bin/check-consul-services.rb
|
170
172
|
- bin/check-nomad-jobs.rb
|
171
173
|
- bin/check-nomad-leader.rb
|
172
174
|
- bin/check-swarm-cluster.rb
|