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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/check-consul-services.rb +54 -0
  3. metadata +3 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d925b07691a99d39e7cdf12783ecfd58b3409703
4
- data.tar.gz: 444ad5ad2f3b229caca724c188ae7343d76422bf
3
+ metadata.gz: c8d408e0d47d404407c8797de17c7d5a6698fb1a
4
+ data.tar.gz: 577f551871f325099a0450dbd1b93584e02d21ea
5
5
  SHA512:
6
- metadata.gz: afdb26ea872cad0f63a6b3c4be3348a93a621ba4ee84d9d4c3b20383a56912d14377d81f332d8d55b489d345f0eada256a7256c0999fb70e3d9c13b851c963bd
7
- data.tar.gz: 5a447d3a70457a9d5148eb018ddb61bfe766b40603d01c07dcc97d7c9d9f8038a219d755292f84776fa3df332be627dab7a5a1fd531ca94ad0a35f4add791119
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.6.4
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