sensu-plugins-edgelab 1.18.5 → 1.18.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4865abee645041b5b0710d7d5144e4b8b779a72b0f96635d6746cd013776678
4
- data.tar.gz: c45cf06c8fbbc4d308f27ed4c4a5e1364263bd6aed6de81c784dfe2e036ef0cf
3
+ metadata.gz: c07defb94b50f10f5f06a9c94c9d58901813282be26da09b4b0bcc5ed7af3818
4
+ data.tar.gz: 8f5b207207f428fa876e33f84e8d56de83f1eaceb26f64c11ee07231fa1f948d
5
5
  SHA512:
6
- metadata.gz: a667dde58a8d07a408ad56e3f36c22378bdd4e69b9755ae03e71d3cae5902d1b15434c2f31f4dfeb48b190082e29bf9035ee6328bc622ce23cd43be5353ddbc6
7
- data.tar.gz: 687e932c3967b53eb3148eacaede0d3b4d3adb70cf7aadd6737b8c914da686fd4bf0e857d7d1f74eb64d691cdb04d8be7909ba53ba6120ee491291bfdca192a2
6
+ metadata.gz: fe10fe2011df65d6ac6ce8cfe7e56e9c763584b4597daf5fe1a4cc3a742809a79b00b17072a383e4056b501b2f4939610cf9d3df32670929bad78759a5cc679f
7
+ data.tar.gz: 844210127c26ea0f1132899c5bf2107d3aaa34ee4d78acba6bae95c7458f9de7b6b872d03176844dc67b5346f668e9fd9a177bb1fca6a1b048e0429cdde97d78
@@ -18,6 +18,11 @@ class CheckNomadAllocations < Sensu::Plugin::Check::CLI
18
18
  long: '--nomad SERVER',
19
19
  default: 'http://localhost:4646'
20
20
 
21
+ option :token,
22
+ description: 'Nomad ACL token to use',
23
+ long: '--token TOKEN',
24
+ default: ''
25
+
21
26
  option :alloc_starting_time,
22
27
  description: '',
23
28
  long: '--alloc-starting-time SECONDS',
@@ -41,8 +46,15 @@ class CheckNomadAllocations < Sensu::Plugin::Check::CLI
41
46
  # Call Nomad api and parse the JSON response
42
47
  def api_call(endpoint)
43
48
  url = config[:nomad] + endpoint
49
+ headers = {}
50
+ if config[:token]
51
+ headers['X-Nomad-Token'] = config[:token]
52
+ end
53
+
44
54
  begin
45
- response = RestClient.get(url)
55
+ response = RestClient.get(url, headers)
56
+ rescue RestClient::ExceptionWithResponse => e
57
+ critical "Error #{e.http_code}: #{e.response}"
46
58
  rescue => e
47
59
  critical "Unable to connect to Nomad: #{e}"
48
60
  else
@@ -18,11 +18,23 @@ class CheckNomadLeader < Sensu::Plugin::Check::CLI
18
18
  long: '--nomad SERVER',
19
19
  default: 'http://localhost:4646'
20
20
 
21
+ # Actually no token is needed to query /v1/status/... endpoints
22
+ # We still add the parameter in case it changes in future versions.
23
+ option :token,
24
+ description: 'Nomad ACL token to use',
25
+ long: '--token TOKEN',
26
+ default: ''
27
+
21
28
  # Call Nomad api and parse the json response
22
29
  def api_call(endpoint)
23
30
  url = config[:nomad] + endpoint
31
+ headers = {}
32
+ if config[:token]
33
+ headers['X-Nomad-Token'] = config[:token]
34
+ end
35
+
24
36
  begin
25
- response = RestClient.get(url)
37
+ response = RestClient.get(url, headers)
26
38
  rescue RestClient::ExceptionWithResponse => e
27
39
  critical "Error #{e.http_code}: #{e.response}"
28
40
  rescue => e
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-edgelab
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.5
4
+ version: 1.18.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edgelab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-10 00:00:00.000000000 Z
11
+ date: 2019-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cassandra-driver
@@ -260,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
260
260
  - !ruby/object:Gem::Version
261
261
  version: '0'
262
262
  requirements: []
263
- rubygems_version: 3.0.2
263
+ rubygems_version: 3.0.4
264
264
  signing_key:
265
265
  specification_version: 4
266
266
  summary: Contains Edgelab plugins for Sensu