sensu-plugins-chef 2.0.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64e900ca4c05e0ade6b23a68681d3dc75790f363
4
- data.tar.gz: 13a83f5184299dcc868b45eb5790dba31d811032
3
+ metadata.gz: 4ee3769260a4f868c839f257d2cf741b51774822
4
+ data.tar.gz: 03b9b504eda3305aeb9d879feff205b2a65b0667
5
5
  SHA512:
6
- metadata.gz: 428455e3c3fc28e5c1ccc0b6f727b5b84b68679dd320066b5431332f78d963cb5e4a9b7db88eea7a137abcd83ab1935d8a61dca32e2a0d859e680fa2a707735e
7
- data.tar.gz: 21d455319a2943255fd3869a432393c72e5272dc2a158cf7b11c1f20941feb9f15b645659068e6d5bc877ac57003f356cd2ee605e38557081e09522e3519a613
6
+ metadata.gz: 39d7e2cdd912841c2c86c1cd9e7cd982a69f117bbe9dd47ff95ab09be68994254ec3d79773fea6027e3cfc5e9f6206fba3b559d7e3244a2712244b985519ce8c
7
+ data.tar.gz: 9094ac0ad6a1239249d1c85058ac73710c93149dfa1a6d95381a7999807f09e2a23198c5456911bbac7ad13e491deafa35a75c4c8c6d471ebce03c1b98e2b323
@@ -4,6 +4,12 @@ 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]
7
+ ## [3.0.0]
8
+ ### Breaking Change
9
+ - re-wrote all checks to use latest ridley. As ridley 5.x requires buff-extension 2.x which requires >= ruby 2.2 and sensu has never shipped with ruby 2.1 the decision was made to drop this support. If you are not using an embedded ruby and are using 2.1 this will break for you. To avoid this you can either switch to embedded ruby or upgrade your ruby to at least 2.2
10
+
11
+ # Added
12
+ - testing for ruby 2.4
7
13
 
8
14
  ## [2.0.1] - 2017-04-28
9
15
  ### Fixed
@@ -27,7 +27,7 @@
27
27
  #
28
28
 
29
29
  require 'sensu-plugin/check/cli'
30
- require 'chef/rest'
30
+ require 'ridley'
31
31
 
32
32
  class ChefNodeChecker < Sensu::Plugin::Check::CLI
33
33
  option :node_name,
@@ -50,13 +50,18 @@ class ChefNodeChecker < Sensu::Plugin::Check::CLI
50
50
  short: '-K CLIENT-KEY',
51
51
  long: '--keys CLIENT-KEY'
52
52
 
53
+ option :ignore_ssl_verification,
54
+ description: 'Ignore SSL certificate verification',
55
+ short: '-i',
56
+ long: '--ignore-ssl'
57
+
53
58
  def connection
54
59
  @connection ||= chef_api_connection
55
60
  end
56
61
 
57
62
  def run
58
- node = connection.get_rest("/nodes/#{config[:node_name]}")
59
- if node['ohai_time']
63
+ node = connection.node.find(config[:node_name])
64
+ if node['automatic']['ohai_time']
60
65
  ok "Node #{config[:node_name]} found"
61
66
  else
62
67
  warning "Node #{config[:node_name]} does not contain 'ohai_time' attribute"
@@ -71,6 +76,10 @@ class ChefNodeChecker < Sensu::Plugin::Check::CLI
71
76
  chef_server_url = config[:chef_server_url]
72
77
  client_name = config[:client_name]
73
78
  signing_key_filename = config[:key]
74
- Chef::REST.new(chef_server_url, client_name, signing_key_filename)
79
+ ignore_ssl = config[:ignore_ssl_verification]
80
+ verify_ssl = ignore_ssl.nil?
81
+
82
+ Celluloid.boot
83
+ Ridley.new(server_url: chef_server_url, client_name: client_name, client_key: signing_key_filename, ssl: { verify: verify_ssl })
75
84
  end
76
85
  end
@@ -32,7 +32,7 @@
32
32
  #
33
33
 
34
34
  require 'sensu-plugin/check/cli'
35
- require 'chef/rest'
35
+ require 'ridley'
36
36
 
37
37
  #
38
38
  # Chef Nodes Status Checker
@@ -68,19 +68,24 @@ class ChefNodesStatusChecker < Sensu::Plugin::Check::CLI
68
68
  long: '--exclude-nodes EXCLUDE-NODES',
69
69
  default: '^$'
70
70
 
71
+ option :ignore_ssl_verification,
72
+ description: 'Ignore SSL certificate verification',
73
+ short: '-i',
74
+ long: '--ignore-ssl'
75
+
71
76
  def connection
72
77
  @connection ||= chef_api_connection
73
78
  end
74
79
 
75
80
  def nodes_last_seen
76
- nodes = connection.get_rest('/nodes')
77
- nodes.delete_if { |node_name| node_name =~ /#{config[:exclude_nodes]}/ }
78
- nodes.keys.map do |node_name|
79
- node = connection.get_rest("/nodes/#{node_name}")
80
- if node['ohai_time']
81
- { node_name => (Time.now - Time.at(node['ohai_time'])) > config[:critical_timespan].to_i }
81
+ nodes = connection.node.all
82
+ nodes.delete_if { |node| node.name =~ /#{config[:exclude_nodes]}/ }
83
+ nodes.map do |node|
84
+ node.reload
85
+ if node['automatic']['ohai_time']
86
+ { node.name => (Time.now - Time.at(node['automatic']['ohai_time'])) > config[:critical_timespan].to_i }
82
87
  else
83
- { node_name => true }
88
+ { node.name => true }
84
89
  end
85
90
  end
86
91
  end
@@ -99,7 +104,11 @@ class ChefNodesStatusChecker < Sensu::Plugin::Check::CLI
99
104
  chef_server_url = config[:chef_server_url]
100
105
  client_name = config[:client_name]
101
106
  signing_key_filename = config[:key]
102
- Chef::REST.new(chef_server_url, client_name, signing_key_filename)
107
+ ignore_ssl = config[:ignore_ssl_verification]
108
+ verify_ssl = ignore_ssl.nil?
109
+
110
+ Celluloid.boot
111
+ Ridley.new(server_url: chef_server_url, client_name: client_name, client_key: signing_key_filename, ssl: { verify: verify_ssl })
103
112
  end
104
113
 
105
114
  def any_node_stuck?
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsChef
2
2
  module Version
3
- MAJOR = 2
3
+ MAJOR = 3
4
4
  MINOR = 0
5
- PATCH = 1
5
+ PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-chef
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 3.0.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: 2017-04-28 00:00:00.000000000 Z
11
+ date: 2017-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 4.1.2
33
+ version: 5.1.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 4.1.2
40
+ version: 5.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sensu-plugin
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.4.1
61
+ version: '0.6'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.4.1
68
+ version: '0.6'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement