sensu-plugins-consul 1.0.0 → 1.1.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/CHANGELOG.md +6 -1
- data/README.md +1 -1
- data/bin/check-consul-service-health.rb +14 -0
- data/bin/check-service-consul.rb +17 -1
- data/lib/sensu-plugins-consul/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8d9c05c1f82ff1a29ed5ce3e040ee63ce264967
|
4
|
+
data.tar.gz: 78fa769434add3aa795a0e3702d5f55ed818a0a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8d00d68c1dbe5413f458a78e124baaac682498c2df76ed6833559e5dde730202150b1e2b5e6c2d3ba3689df112efab4f288a4285fc8432015a5c5bbab574665
|
7
|
+
data.tar.gz: f9966a4e39326c0e6b8a6f0d2b9505bd54f18e60cb85c2ede097b87163eefe1c7f0d12cb3bb38996176863a8ceb765aa1b51172617edebfdf5c6b09ebb081d6b
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,10 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [1.1.0] - 2016-08-03
|
9
|
+
### Added
|
10
|
+
- check-consul-service-health and check-service-consul now accept a --fail-if-not-found argument @wg-tsuereth
|
11
|
+
|
8
12
|
## [1.0.0] - 2016-06-28
|
9
13
|
### Fixed
|
10
14
|
- Fixed check-consul-service-health and check-service-consul --all argument @wg-tsuereth
|
@@ -60,7 +64,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
60
64
|
### Added
|
61
65
|
- initial release
|
62
66
|
|
63
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/1.
|
67
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/1.1.0...HEAD
|
68
|
+
[1.1.0]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/1.0.0...1.1.0
|
64
69
|
[1.0.0]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/0.1.7...1.0.0
|
65
70
|
[0.1.7]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/0.0.7...0.1.7
|
66
71
|
[0.0.7]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/0.0.6...0.0.7
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
## Sensu-Plugins-consul
|
2
2
|
|
3
|
-
[
|
3
|
+
[](https://travis-ci.org/sensu-plugins/sensu-plugins-consul)
|
4
4
|
[](http://badge.fury.io/rb/sensu-plugins-consul)
|
5
5
|
[](https://codeclimate.com/github/sensu-plugins/sensu-plugins-consul)
|
6
6
|
[](https://codeclimate.com/github/sensu-plugins/sensu-plugins-consul)
|
@@ -53,6 +53,11 @@ class CheckConsulServiceHealth < Sensu::Plugin::Check::CLI
|
|
53
53
|
short: '-a',
|
54
54
|
long: '--all'
|
55
55
|
|
56
|
+
option :fail_if_not_found,
|
57
|
+
description: 'fail if no service is found',
|
58
|
+
short: '-f',
|
59
|
+
long: '--fail-if-not-found'
|
60
|
+
|
56
61
|
# Get the service checks for the given service
|
57
62
|
def acquire_service_data
|
58
63
|
if config[:all]
|
@@ -68,12 +73,14 @@ class CheckConsulServiceHealth < Sensu::Plugin::Check::CLI
|
|
68
73
|
dc.url = config[:consul]
|
69
74
|
end
|
70
75
|
|
76
|
+
found = false
|
71
77
|
warnings = false
|
72
78
|
criticals = false
|
73
79
|
checks = {}
|
74
80
|
|
75
81
|
# Process all of the nonpassing service checks
|
76
82
|
acquire_service_data.each do |d|
|
83
|
+
found = true
|
77
84
|
checkId = d['CheckID'] # rubocop:disable Style/VariableName
|
78
85
|
checkStatus = d['Status'] # rubocop:disable Style/VariableName
|
79
86
|
|
@@ -86,6 +93,13 @@ class CheckConsulServiceHealth < Sensu::Plugin::Check::CLI
|
|
86
93
|
criticals = true if %w(critical unknown).include? checkStatus
|
87
94
|
end
|
88
95
|
|
96
|
+
if config[:fail_if_not_found] && !found
|
97
|
+
msg = 'Could not find checks for any services'
|
98
|
+
if config[:service]
|
99
|
+
msg = "Could not find checks for service #{config[:service]}"
|
100
|
+
end
|
101
|
+
critical msg
|
102
|
+
end
|
89
103
|
critical checks if criticals
|
90
104
|
warning checks if warnings
|
91
105
|
ok
|
data/bin/check-service-consul.rb
CHANGED
@@ -51,6 +51,11 @@ class ServiceStatus < Sensu::Plugin::Check::CLI
|
|
51
51
|
short: '-a',
|
52
52
|
long: '--all'
|
53
53
|
|
54
|
+
option :fail_if_not_found,
|
55
|
+
description: 'fail if no service is found',
|
56
|
+
short: '-f',
|
57
|
+
long: '--fail-if-not-found'
|
58
|
+
|
54
59
|
# Get the check data for the service from consul
|
55
60
|
#
|
56
61
|
def acquire_service_data
|
@@ -89,7 +94,18 @@ class ServiceStatus < Sensu::Plugin::Check::CLI
|
|
89
94
|
'notes' => d['Notes']
|
90
95
|
} if d['Status'] == 'failing'
|
91
96
|
end
|
92
|
-
|
97
|
+
|
98
|
+
if failing.empty? && passing.empty?
|
99
|
+
msg = 'Could not find checks for any services'
|
100
|
+
if config[:service]
|
101
|
+
msg = "Could not find checks for service #{config[:service]}"
|
102
|
+
end
|
103
|
+
if config[:fail_if_not_found]
|
104
|
+
critical msg
|
105
|
+
else
|
106
|
+
unknown msg
|
107
|
+
end
|
108
|
+
end
|
93
109
|
critical failing unless failing.empty?
|
94
110
|
ok passing unless passing.empty?
|
95
111
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-consul
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sensu Plugins and contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|
@@ -237,4 +237,3 @@ signing_key:
|
|
237
237
|
specification_version: 4
|
238
238
|
summary: Sensu plugins for Consul
|
239
239
|
test_files: []
|
240
|
-
has_rdoc:
|