diplomat 2.6.1 → 2.6.2
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/README.md +34 -0
- data/lib/diplomat/health.rb +18 -9
- data/lib/diplomat/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: 602c9e392d4e521d6b749aa0b9cfb46cead8e1a16547c6e62f480e12230bbde5
|
4
|
+
data.tar.gz: 67fac5cfa5529c346e3a7deb2108dda46aeda3c728b4376b347a34b9781edded
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e75b590b288dec5984484dca08ae682459fae2855cad9e09566b9d6f5cff151a53522b698e19542d986a8b1a6682f57f567e353f17d1c8166212d92e19f41a6c
|
7
|
+
data.tar.gz: 1d0f7b3878d1431a2e45525cd9ac74d11965a051141ef245e4fd884a8848ee8f1bf09ab356daa10914392152f5be7b10c81880ce934f0a6775a8e91e54163870
|
data/README.md
CHANGED
@@ -331,6 +331,40 @@ Get the health status from autopilot
|
|
331
331
|
Diplomat::Autopilot.get_health()
|
332
332
|
```
|
333
333
|
|
334
|
+
### Health
|
335
|
+
|
336
|
+
Retrieve health of a node
|
337
|
+
|
338
|
+
```ruby
|
339
|
+
Diplomat::Health.node('fooNode', :dc => 'abc')
|
340
|
+
```
|
341
|
+
|
342
|
+
Retrieve health of a given check
|
343
|
+
|
344
|
+
```ruby
|
345
|
+
Diplomat::Health.checks('fooCheck', :dc => 'abc')
|
346
|
+
```
|
347
|
+
|
348
|
+
Retrieve health of a given service
|
349
|
+
|
350
|
+
```ruby
|
351
|
+
Diplomat::Health.service('fooService', :dc => 'abc')
|
352
|
+
```
|
353
|
+
|
354
|
+
Retrieve a list of anything that correspond to the state ("any", "passing", "warning", or "critical")
|
355
|
+
You can use filters too !
|
356
|
+
|
357
|
+
```ruby
|
358
|
+
Diplomat::Health.state("critical", {:dc => 'abc', :filter => 'Node==foo'})
|
359
|
+
```
|
360
|
+
|
361
|
+
You also have some convenience method (`any`, `passing`, `warning`, `critical`)
|
362
|
+
That can be filtered
|
363
|
+
|
364
|
+
```ruby
|
365
|
+
Diplomat::Health.critical({:dc => 'abc', :filter => 'Service==foo'})
|
366
|
+
```
|
367
|
+
|
334
368
|
### Maintenance mode
|
335
369
|
|
336
370
|
Enable maintenance mode on a host, with optional reason and DC (requires access to local agent)
|
data/lib/diplomat/health.rb
CHANGED
@@ -59,35 +59,44 @@ module Diplomat
|
|
59
59
|
|
60
60
|
# Get service health
|
61
61
|
# @param s [String] the state ("any", "passing", "warning", or "critical")
|
62
|
-
# @param options [Hash] :dc string for
|
62
|
+
# @param options [Hash] :dc, :near, :filter string for specific query
|
63
63
|
# @return [OpenStruct] all data associated with the node
|
64
64
|
def state(s, options = {})
|
65
65
|
custom_params = []
|
66
66
|
custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
|
67
67
|
custom_params << use_named_parameter('near', options[:near]) if options[:near]
|
68
|
+
custom_params << use_named_parameter('filter', options[:filter]) if options[:filter]
|
68
69
|
|
69
70
|
ret = send_get_request(@conn, ["/v1/health/state/#{s}"], options, custom_params)
|
70
71
|
JSON.parse(ret.body).map { |status| OpenStruct.new status }
|
71
72
|
end
|
72
73
|
|
73
74
|
# Convenience method to get services in any state
|
74
|
-
|
75
|
-
|
75
|
+
# @param options [Hash] :dc, :near, :filter string for specific query
|
76
|
+
# @return [OpenStruct] all data associated with the node
|
77
|
+
def any(options = {})
|
78
|
+
state('any', options)
|
76
79
|
end
|
77
80
|
|
78
81
|
# Convenience method to get services in passing state
|
79
|
-
|
80
|
-
|
82
|
+
# @param options [Hash] :dc, :near, :filter string for specific query
|
83
|
+
# @return [OpenStruct] all data associated with the node
|
84
|
+
def passing(options = {})
|
85
|
+
state('passing', options)
|
81
86
|
end
|
82
87
|
|
83
88
|
# Convenience method to get services in warning state
|
84
|
-
|
85
|
-
|
89
|
+
# @param options [Hash] :dc, :near, :filter string for specific query
|
90
|
+
# @return [OpenStruct] all data associated with the node
|
91
|
+
def warning(options = {})
|
92
|
+
state('warning', options)
|
86
93
|
end
|
87
94
|
|
88
95
|
# Convenience method to get services in critical state
|
89
|
-
|
90
|
-
|
96
|
+
# @param options [Hash] :dc, :near, :filter string for specific query
|
97
|
+
# @return [OpenStruct] all data associated with the node
|
98
|
+
def critical(options = {})
|
99
|
+
state('critical', options)
|
91
100
|
end
|
92
101
|
end
|
93
102
|
end
|
data/lib/diplomat/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diplomat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Hamelink
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-
|
13
|
+
date: 2022-02-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|