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 +4 -4
- data/CHANGELOG.md +6 -0
- data/bin/check-chef-node.rb +13 -4
- data/bin/check-chef-nodes.rb +18 -9
- data/lib/sensu-plugins-chef/version.rb +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ee3769260a4f868c839f257d2cf741b51774822
|
4
|
+
data.tar.gz: 03b9b504eda3305aeb9d879feff205b2a65b0667
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39d7e2cdd912841c2c86c1cd9e7cd982a69f117bbe9dd47ff95ab09be68994254ec3d79773fea6027e3cfc5e9f6206fba3b559d7e3244a2712244b985519ce8c
|
7
|
+
data.tar.gz: 9094ac0ad6a1239249d1c85058ac73710c93149dfa1a6d95381a7999807f09e2a23198c5456911bbac7ad13e491deafa35a75c4c8c6d471ebce03c1b98e2b323
|
data/CHANGELOG.md
CHANGED
@@ -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
|
data/bin/check-chef-node.rb
CHANGED
@@ -27,7 +27,7 @@
|
|
27
27
|
#
|
28
28
|
|
29
29
|
require 'sensu-plugin/check/cli'
|
30
|
-
require '
|
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.
|
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
|
-
|
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
|
data/bin/check-chef-nodes.rb
CHANGED
@@ -32,7 +32,7 @@
|
|
32
32
|
#
|
33
33
|
|
34
34
|
require 'sensu-plugin/check/cli'
|
35
|
-
require '
|
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.
|
77
|
-
nodes.delete_if { |
|
78
|
-
nodes.
|
79
|
-
node
|
80
|
-
if node['ohai_time']
|
81
|
-
{
|
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
|
-
{
|
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
|
-
|
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?
|
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:
|
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-
|
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:
|
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:
|
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.
|
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.
|
68
|
+
version: '0.6'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|