sensu-plugins-edgelab 1.2.3 → 1.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c31c6c21f0a5babe6c6b5dd37c1cee1fb8e50dbf
4
- data.tar.gz: 115871cd9dcdcc7a08c699b7c0b603cc0ceca937
3
+ metadata.gz: 0387fed665b27d07fd446d1ca0c454d1a4593895
4
+ data.tar.gz: d3a9ccf156a3482f21fdc8afc1117fa9e8e466cb
5
5
  SHA512:
6
- metadata.gz: 18f0ff0025f8ef24f349550021492d4d7cb9ec71cf7ed99fc1c3fdb0f31d4aafb6350c291cff405fdc3cf9cf9dbeeaa19f848c3fb3603b4f02443aaf8c582678
7
- data.tar.gz: 432ffee07129e3a7f6bbfb44dfb901942b1439459427ebeac15c3666916ab08126a94af27e615b9f2f5bbbd351bf2bf7d26084c7a5a4773c0c59546a670d91b3
6
+ metadata.gz: fe6a60f1fbcf28e0309a9cb8fc031438d7a6578e95453e71eed954f76ccf439f6aafe1c4b2397e991516f1fee0375d53f4f9bb7b5764c78977c05fae1d7bb5ad
7
+ data.tar.gz: 80d680428dd233a0e7b3ad0c3b392d05db26f1f31b0fd9ebf6f41e6d6e29408f0d073da523f6183a9337486669d6c81df5c52926079665ff21ee2291f1dd0449
@@ -14,7 +14,7 @@ require 'json'
14
14
 
15
15
  class CheckNomadAllocations < Sensu::Plugin::Check::CLI
16
16
  option :nomad,
17
- description: 'nomad server address',
17
+ description: 'Nomad server URL',
18
18
  long: '--nomad SERVER',
19
19
  default: 'http://localhost:4646'
20
20
  option :alloc_starting_time,
@@ -22,7 +22,7 @@ class CheckNomadAllocations < Sensu::Plugin::Check::CLI
22
22
  long: '--alloc-starting-time',
23
23
  default: 300
24
24
 
25
- # Call Nomad api and parse the json response
25
+ # Call Nomad api and parse the JSON response
26
26
  def api_call(endpoint)
27
27
  url = config[:nomad] + endpoint
28
28
  begin
@@ -33,7 +33,7 @@ class CheckNomadAllocations < Sensu::Plugin::Check::CLI
33
33
  begin
34
34
  return JSON.parse(response)
35
35
  rescue => e
36
- critical "Unable to parse json in response: #{e}"
36
+ critical "Unable to parse JSON in response: #{e}"
37
37
  end
38
38
  end
39
39
  end
@@ -0,0 +1,41 @@
1
+ #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # check-nomad-leader
6
+ #
7
+ # DESCRIPTION:
8
+ # This plugin checks there's a Nomad server node elected as a leader.
9
+ #
10
+
11
+ require 'sensu-plugin/check/cli'
12
+ require 'rest-client'
13
+ require 'json'
14
+
15
+ class CheckNomadLeader < Sensu::Plugin::Check::CLI
16
+ option :nomad,
17
+ description: 'Nomad server URL',
18
+ long: '--nomad SERVER',
19
+ default: 'http://localhost:4646'
20
+
21
+ # Call Nomad api and parse the json response
22
+ def api_call(endpoint)
23
+ url = config[:nomad] + endpoint
24
+ begin
25
+ response = RestClient.get(url)
26
+ rescue => e
27
+ critical "Error #{e.http_code}: #{e.response}"
28
+ else
29
+ begin
30
+ return JSON.parse(response)
31
+ rescue => e
32
+ critical "Unable to parse JSON in response: #{e}"
33
+ end
34
+ end
35
+ end
36
+
37
+ def run
38
+ leader = api_call '/v1/status/leader'
39
+ ok "Nomad leader is #{leader}"
40
+ end
41
+ end
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.2.3
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edgelab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-23 00:00:00.000000000 Z
11
+ date: 2017-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -111,6 +111,7 @@ dependencies:
111
111
  description: Sensu plugins developed by Edgelab
112
112
  email:
113
113
  executables:
114
+ - check-nomad-leader.rb
114
115
  - metrics-swarm-cluster.rb
115
116
  - check-apt-expired-keys.rb
116
117
  - check-nomad-jobs.rb
@@ -121,6 +122,7 @@ extra_rdoc_files: []
121
122
  files:
122
123
  - bin/check-apt-expired-keys.rb
123
124
  - bin/check-nomad-jobs.rb
125
+ - bin/check-nomad-leader.rb
124
126
  - bin/check-swarm-cluster.rb
125
127
  - bin/metrics-mysql-processes.rb
126
128
  - bin/metrics-swarm-cluster.rb