sensu-plugins-consul 0.0.2 → 0.0.3
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +2 -0
- data/bin/check-consul-failures.rb +62 -0
- data/lib/sensu-plugins-consul/version.rb +1 -1
- metadata +6 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89c6824264dd6958053cf103ed548d0836b01bfb
|
4
|
+
data.tar.gz: 262d21085927e5f2ea11c55fdbd25bcb52ee3582
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 337a603b5449501304c8f74f77476bc4eea25237915ed89ad01c9d10b4cb5552ac1f04f31a39652e37299118a94291ec40a8601a861a67ecaf47a859c26a6067
|
7
|
+
data.tar.gz: e04280e938a3cf61dd3d2b6ea61f3391bab9b9555e3126bff4add91c6d91e1fee4d53d0db8334b372285ce3ce467949a5d71e701d96aa3180880fcd66f7571f4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
4
4
|
This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
|
5
5
|
|
6
6
|
## Unreleased][unreleased]
|
7
|
+
### Fixed
|
8
|
+
- Added check to support removing of failed consul nodes from the cluster
|
7
9
|
|
8
10
|
## 0.0.1 - 2015-05-21
|
9
11
|
|
@@ -0,0 +1,62 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# OUTPUT:
|
4
|
+
# plain text
|
5
|
+
#
|
6
|
+
# PLATFORMS:
|
7
|
+
# Linux
|
8
|
+
#
|
9
|
+
# DEPENDENCIES:
|
10
|
+
# gem: sensu-plugin
|
11
|
+
# gem: rest-client
|
12
|
+
#
|
13
|
+
# Consul returns the numerical values for consul members state, which the
|
14
|
+
# numbers used are defined in : https://github.com/hashicorp/serf/blob/master/serf/serf.go
|
15
|
+
#
|
16
|
+
# StatusNone MemberStatus = iota (0, "none")
|
17
|
+
# StatusAlive (1, "alive")
|
18
|
+
# StatusLeaving (2, "leaving")
|
19
|
+
# StatusLeft (3, "left")
|
20
|
+
# StatusFailed (4, "failed")
|
21
|
+
#
|
22
|
+
|
23
|
+
require 'rubygems' if RUBY_VERSION < '1.9.0'
|
24
|
+
require 'sensu-plugin/check/cli'
|
25
|
+
require 'rest-client'
|
26
|
+
require 'json'
|
27
|
+
|
28
|
+
class ConsulStatus < Sensu::Plugin::Check::CLI
|
29
|
+
option :server,
|
30
|
+
description: 'consul server',
|
31
|
+
short: '-s SERVER',
|
32
|
+
long: '--server SERVER',
|
33
|
+
default: '127.0.0.1'
|
34
|
+
|
35
|
+
option :port,
|
36
|
+
description: 'consul http port',
|
37
|
+
short: '-p PORT',
|
38
|
+
long: '--port PORT',
|
39
|
+
default: '8500'
|
40
|
+
|
41
|
+
def run
|
42
|
+
r = RestClient::Resource.new("http://#{config[:server]}:#{config[:port]}/v1/agent/members", timeout: 5).get
|
43
|
+
if r.code == 200
|
44
|
+
failing_nodes = JSON.parse(r).find_all { |node| node['Status'] == 4 }
|
45
|
+
if !failing_nodes.nil? && !failing_nodes.empty?
|
46
|
+
failing_nodes.each_entry do |node|
|
47
|
+
puts "Name: #{node['Name']}"
|
48
|
+
RestClient::Resource.new("http://#{config[:server]}:#{config[:port]}/v1/agent/force-leave/#{node['Name']}", timeout: 5).get
|
49
|
+
end
|
50
|
+
ok 'Removed failed consul nodes'
|
51
|
+
else
|
52
|
+
ok 'No consul nodes to remove'
|
53
|
+
end
|
54
|
+
else
|
55
|
+
critical 'Consul is not responding'
|
56
|
+
end
|
57
|
+
rescue Errno::ECONNREFUSED
|
58
|
+
critical 'Consul is not responding'
|
59
|
+
rescue RestClient::RequestTimeout
|
60
|
+
critical 'Consul Connection timed out'
|
61
|
+
end
|
62
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-consul
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sensu Plugins and contributors
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
|
31
31
|
HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2015-06-
|
33
|
+
date: 2015-06-27 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: sensu-plugin
|
@@ -92,14 +92,14 @@ dependencies:
|
|
92
92
|
name: rubocop
|
93
93
|
requirement: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - '='
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0.30'
|
98
98
|
type: :development
|
99
99
|
prerelease: false
|
100
100
|
version_requirements: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- -
|
102
|
+
- - '='
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '0.30'
|
105
105
|
- !ruby/object:Gem::Dependency
|
@@ -205,12 +205,14 @@ email: "<sensu-users@googlegroups.com>"
|
|
205
205
|
executables:
|
206
206
|
- check-service-consul.rb
|
207
207
|
- check-consul-leader.rb
|
208
|
+
- check-consul-failures.rb
|
208
209
|
extensions: []
|
209
210
|
extra_rdoc_files: []
|
210
211
|
files:
|
211
212
|
- CHANGELOG.md
|
212
213
|
- LICENSE
|
213
214
|
- README.md
|
215
|
+
- bin/check-consul-failures.rb
|
214
216
|
- bin/check-consul-leader.rb
|
215
217
|
- bin/check-service-consul.rb
|
216
218
|
- lib/sensu-plugins-consul.rb
|
metadata.gz.sig
CHANGED
Binary file
|