sensu-plugins-chef 7.0.0 → 7.1.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
  SHA256:
3
- metadata.gz: e5a3091f48716a0af51085b2553ae6e3a68c7107f22b909bcdd02e55a205fe22
4
- data.tar.gz: 00c2ff6e4fbaed34eb1d76034cfc956a0d9ceceb1162c43f3405b879098b60ee
3
+ metadata.gz: f7954a7930c5a6b28e6db2ad220bae833648c40fc161b8791753d10609c74470
4
+ data.tar.gz: 9d62de7208d17c6e7ebe36af223e7f47a6ef039e4e72f8c032b0eeb2be8088da
5
5
  SHA512:
6
- metadata.gz: 697a7dccbf9ec43de5be55f90744c699d8c2e8029520f2c0a028db63f23ee086d8606ce03ac4cc6c1d02406b774fe798cf6b324578cc6ee753d226863b019c33
7
- data.tar.gz: 19f26e09602d06f612f5a36337314328615ed047fd0d90b332247998ae5132bc83eec1b9c5b4f92f63d9329f069187949088260b99656eafd81478e6e118486e
6
+ metadata.gz: 29a3fa0b14e4a7542263043ba69a6fe8fba60f46a965771513dacb92d7f1e0353354bc9f35da459fed6f030123994f94eb29821d6214fd9c0f3951fbcdd4fb1b
7
+ data.tar.gz: ee2c1b5207d72d1d36c6501ebee5804a121a3d9d8129448042e5ff6fc90838bdd370a777315763d7de97d98f2e6f789f6d52c247995c4d094dc7101a74f55d0c
data/CHANGELOG.md CHANGED
@@ -5,6 +5,18 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [7.1.0] - 2021-05-05
9
+
10
+ ### Changed
11
+ - Update development dependancy for github-markdown
12
+ - Update development dependancy for rake
13
+ - Update development dependancy for bundler
14
+ - Update development dependancy for rubocop
15
+ - Update Readme with additional documentation
16
+
17
+ ### Fixed
18
+ - Fixed errors in bonsai asset defitions
19
+
8
20
  ## [7.0.0] - 2019-4-19
9
21
  ### Breaking Changes
10
22
  - Bump `sensu-plugin` dependency from `~> 3.0` to `~> 4.0` you can read the changelog entries for [4.0](https://github.com/sensu-plugins/sensu-plugin/blob/master/CHANGELOG.md#400---2018-02-17), [3.0](https://github.com/sensu-plugins/sensu-plugin/blob/master/CHANGELOG.md#300---2018-12-04), and [2.0](https://github.com/sensu-plugins/sensu-plugin/blob/master/CHANGELOG.md#v200---2017-03-29)
@@ -114,7 +126,8 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
114
126
  ### Added
115
127
  - initial release
116
128
 
117
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-chef/compare/7.0.0...HEAD
129
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-chef/compare/7.1.0...HEAD
130
+ [7.1.0]: https://github.com/sensu-plugins/sensu-plugins-chef/compare/7.0.0...7.1.0
118
131
  [7.0.0]: https://github.com/sensu-plugins/sensu-plugins-chef/compare/6.0.0...7.0.0
119
132
  [6.0.0]: https://github.com/sensu-plugins/sensu-plugins-chef/compare/5.0.1...6.0.1
120
133
  [5.0.1]: https://github.com/sensu-plugins/sensu-plugins-chef/compare/5.0.0...5.0.1
data/README.md CHANGED
@@ -1,28 +1,147 @@
1
- ## Sensu-Plugins-chef
2
-
1
+ [![Sensu Bonsai Asset](https://img.shields.io/badge/Bonsai-Download%20Me-brightgreen.svg?colorB=89C967&logo=sensu)](https://bonsai.sensu.io/assets/sensu-plugins/sensu-plugins-chef)
3
2
  [![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-chef.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-chef)
4
3
  [![Gem Version](https://badge.fury.io/rb/sensu-plugins-chef.svg)](http://badge.fury.io/rb/sensu-plugins-chef)
5
4
  [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-chef/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-chef)
6
5
  [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-chef/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-chef)
7
- [![Sensu Bonsai Asset](https://img.shields.io/badge/Bonsai-Download%20Me-brightgreen.svg?colorB=89C967&logo=sensu)](https://bonsai.sensu.io/assets/sensu-plugins/sensu-plugins-chef)
8
6
 
9
- ## Sensu Asset
10
- The Sensu assets packaged from this repository are built against the Sensu ruby runtime environment. When using these assets as part of a Sensu Go resource (check, mutator or handler), make sure you include the corresponding Sensu ruby runtime asset in the list of assets needed by the resource. The current ruby-runtime assets can be found [here](https://bonsai.sensu.io/assets/sensu/sensu-ruby-runtime) in the [Bonsai Asset Index](bonsai.sensu.io).
7
+ ## Sensu Plugins Chef Plugin
11
8
 
9
+ - [Overview](#overview)
10
+ - [Files](#files)
11
+ - [Usage examples](#usage-examples)
12
+ - [Configuration](#configuration)
13
+ - [Sensu Go](#sensu-go)
14
+ - [Asset registration](#asset-registration)
15
+ - [Asset definition](#asset-definition)
16
+ - [Check definition](#check-definition)
17
+ - [Sensu Core](#sensu-core)
18
+ - [Check definition](#check-definition)
19
+ - [Installation from source](#installation-from-source)
20
+ - [Additional notes](#additional-notes)
21
+ - [Contributing](#contributing)
12
22
 
13
- ## Functionality
23
+ ### Overview
14
24
 
15
- ## Files
16
- * bin/check-chef-nodes.rb
25
+ This plugin provides native instrumentation for monitoring Chef, including service health checks (via chef-server-ctl) and chef node status, and a Sensu handler for removing stale Sensu clients.
26
+
27
+ ### Files
17
28
  * bin/check-chef-node.rb
29
+ * bin/check-chef-nodes.rb
18
30
  * bin/check-chef-server.rb
19
31
  * bin/handler-chef-node.rb
32
+
33
+ **check-chef-node**
34
+ Checks if a node exists.
35
+
36
+ **check-chef-nodes**
37
+ Reports nodes from your cluster that were last seen before the specified number of seconds.
38
+
39
+ **check-chef-server**
40
+ Uses Chef Server's `chef-server-ctl` to check whether any component of the Chef Server is not running. You must run this plugin with elevated privileges (sudo) or it will fail with unknown state.
41
+
42
+ **handler-chef-node**
43
+ Removes a Sensu client if its Chef node data no longer exists.
44
+
45
+ ## Usage examples
46
+
47
+ ### Help
48
+
49
+ **check-chef-node.rb**
50
+ ```
51
+ Usage: check-chef-node.rb (options)
52
+ -U, --url CHEF-SERVER-URL URL of Chef server
53
+ -C, --client CLIENT-NAME Client name
54
+ -i, --ignore-ssl Ignore SSL certificate verification
55
+ -K, --keys CLIENT-KEY Client's key
56
+ -n, --node-name NODE-NAME Check if this node name exists
57
+ ```
58
+
59
+ **handler-chef-node.rb**
60
+ ```
61
+ Usage: handler-chef-node.rb (options)
62
+ --map-go-event-into-ruby Enable Sensu Go to Sensu Ruby event mapping. Alternatively set envvar SENSU_MAP_GO_EVENT_INTO_RUBY=1.
63
+
64
+ ```
65
+
66
+ ## Configuration
67
+ ### Sensu Go
68
+ #### Asset registration
69
+
70
+ Assets are the best way to make use of this plugin. If you're not using an asset, please consider doing so! If you're using sensuctl 5.13 or later, you can use the following command to add the asset:
71
+
72
+ `sensuctl asset add sensu-plugins/sensu-plugins-chef`
73
+
74
+ If you're using an earlier version of sensuctl, you can download the asset definition from [this project's Bonsai asset index page](https://bonsai.sensu.io/assets/sensu-plugins/sensu-plugins-chef).
75
+
76
+ #### Asset definition
77
+
78
+ ```yaml
79
+ ---
80
+ type: Asset
81
+ api_version: core/v2
82
+ metadata:
83
+ name: sensu-plugins-chef
84
+ spec:
85
+ url: https://assets.bonsai.sensu.io/94e44dc0b89b7cd8318c38db5f64f788642140d8/sensu-plugins-chef_7.0.0_centos_linux_amd64.tar.gz
86
+ sha512: f468ea0060ab890004a3f5bd09deff5bdd98db9e7a4c9ffc0ad1c8809b0e5a8198737f23ec850e9f5181fd590aafa5b895dd948b264244770c77b5f03fa523ef
87
+ ```
88
+
89
+ #### Check definition
90
+
91
+ ```yaml
92
+ ---
93
+ type: CheckConfig
94
+ spec:
95
+ command: "check-chef-nodes.rb"
96
+ handlers: []
97
+ high_flap_threshold: 0
98
+ interval: 10
99
+ low_flap_threshold: 0
100
+ publish: true
101
+ runtime_assets:
102
+ - sensu-plugins/sensu-plugins-chef
103
+ - sensu/sensu-ruby-runtime
104
+ subscriptions:
105
+ - linux
106
+ ```
107
+
108
+ ### Sensu Core
109
+
110
+ #### Check definition
111
+ ```json
112
+ {
113
+ "checks": {
114
+ "check-chef-nodes": {
115
+ "command": "check-chef-nodes.rb",
116
+ "subscribers": ["linux"],
117
+ "interval": 10,
118
+ "refresh": 10,
119
+ "handlers": ["influxdb"]
120
+ }
121
+ }
122
+ }
123
+ ```
124
+
125
+ ## Installation from source
126
+
127
+ ### Sensu Go
128
+
129
+ See the instructions above for [asset registration](#asset-registration).
130
+
131
+ ### Sensu Core
132
+
133
+ Install and setup plugins on [Sensu Core](https://docs.sensu.io/sensu-core/latest/installation/installing-plugins/).
134
+
135
+ ## Additional notes
136
+
137
+ ### Sensu Go Ruby Runtime Assets
138
+
139
+ The Sensu assets packaged from this repository are built against the Sensu Ruby runtime environment. When using these assets as part of a Sensu Go resource (check, mutator, or handler), make sure to include the corresponding [Sensu Ruby Runtime Asset](https://bonsai.sensu.io/assets/sensu/sensu-ruby-runtime) in the list of assets needed by the resource.
20
140
 
21
- ## Usage
141
+ ### Use this plugin with Sensu Go
22
142
 
23
- ## Installation
143
+ To use `handler-chef-node.rb` with Sensu Go, you will need to use the event mapping command line option. See `handler-chef-node.rb --help` for details. Read the [sensu-plugin README](https://github.com/sensu-plugins/sensu-plugin#sensu-go-enablement) for more information about the event mapping functionality.
24
144
 
25
- [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
145
+ ## Contributing
26
146
 
27
- ## Notes
28
- When using `handler-chef-node.rb` with Sensu Go, you will need to use the event mapping commandline option, see `handler-chef-node.rb --help` for details. And please read [the sensu-plugin README](https://github.com/sensu-plugins/sensu-plugin#sensu-go-enablement) for more information on the event mapping functionality.
147
+ See [CONTRIBUTING.md](https://github.com/sensu-plugins/sensu-plugins-chef/blob/master/CONTRIBUTING.md) for information about contributing to this plugin.
@@ -1,5 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
- #
2
+ # frozen_string_literal: true
3
+
3
4
  # check-chef-node
4
5
  #
5
6
  # DESCRIPTION:
@@ -1,5 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
- #
2
+ # frozen_string_literal: true
3
+
3
4
  # check-chef-nodes
4
5
  #
5
6
  # DESCRIPTION:
@@ -1,5 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
- #
2
+ # frozen_string_literal: true
3
+
3
4
  # check-chef-server
4
5
  #
5
6
  # DESCRIPTION:
@@ -48,7 +49,7 @@ class CheckChefServer < Sensu::Plugin::Check::CLI
48
49
  failed_processes << proc.match('^(fail|down|warning):\s+([a-z-]+)')[2]
49
50
  end
50
51
  end
51
- if failed_processes.count > 0
52
+ if failed_processes.count.positive?
52
53
  critical("chef-server service(s): #{failed_processes.join(', ')} #{failed_processes.count == 1 ? 'is' : 'are'} failed, down, or in warning state")
53
54
  else
54
55
  ok
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
2
4
  #
3
5
  # This handler removes a Sensu client if its Chef node data
4
6
  # no longer exists.
@@ -66,17 +68,17 @@ class ChefNode < Sensu::Handler
66
68
  r.node.find(@event['client']['name']) ? true : false
67
69
  end
68
70
  # FIXME: Why is this necessary? Ridley works fine outside of Sensu
69
- rescue Celluloid::Error
71
+ rescue Celluloid::Error => e
70
72
  Celluloid.boot
71
73
  retried += 1
72
74
  if retried < 2
73
75
  retry
74
76
  else
75
- puts "CHEF-NODE: Ridley is broken: #{error.inspect}"
77
+ puts "CHEF-NODE: Ridley is broken: #{e.inspect}"
76
78
  true
77
79
  end
78
- rescue StandardError => error
79
- puts "CHEF-NODE: Unexpected error: #{error.inspect}"
80
+ rescue StandardError => e
81
+ puts "CHEF-NODE: Unexpected error: #{e.inspect}"
80
82
  true
81
83
  end
82
84
  end
@@ -84,14 +86,14 @@ class ChefNode < Sensu::Handler
84
86
  def delete_sensu_client!
85
87
  api_request(:DELETE, '/clients/' + @event['client']['name'])
86
88
  puts "CHEF-NODE: Successfully deleted Sensu client #{@event['client']['name']}"
87
- rescue StandardError => error
88
- puts "CHEF-NODE: Unexpected error: #{error.inspect}"
89
+ rescue StandardError => e
90
+ puts "CHEF-NODE: Unexpected error: #{e.inspect}"
89
91
  end
90
92
 
91
93
  def filter; end
92
94
 
93
95
  def handle
94
- unless chef_node_exists? # rubocop:disable GuardClause
96
+ unless chef_node_exists? # rubocop:disable Style/GuardClause
95
97
  delete_sensu_client!
96
98
  end
97
99
  end
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'sensu-plugins-chef/version'
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SensuPluginsChef
2
4
  module Version
3
5
  MAJOR = 7
4
- MINOR = 0
6
+ MINOR = 1
5
7
  PATCH = 0
6
8
 
7
9
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
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: 7.0.0
4
+ version: 7.1.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: 2019-04-20 00:00:00.000000000 Z
11
+ date: 2021-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -78,14 +78,14 @@ dependencies:
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '1.12'
81
+ version: '2.1'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '1.12'
88
+ version: '2.1'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: codeclimate-test-reporter
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -106,14 +106,14 @@ dependencies:
106
106
  requirements:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: '3.0'
109
+ version: '4.0'
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: '3.0'
116
+ version: '4.0'
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: pry
119
119
  requirement: !ruby/object:Gem::Requirement
@@ -134,14 +134,14 @@ dependencies:
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: '12.3'
137
+ version: '13.0'
138
138
  type: :development
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '12.3'
144
+ version: '13.0'
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: redcarpet
147
147
  requirement: !ruby/object:Gem::Requirement
@@ -176,14 +176,14 @@ dependencies:
176
176
  requirements:
177
177
  - - "~>"
178
178
  - !ruby/object:Gem::Version
179
- version: 0.51.0
179
+ version: 0.81.0
180
180
  type: :development
181
181
  prerelease: false
182
182
  version_requirements: !ruby/object:Gem::Requirement
183
183
  requirements:
184
184
  - - "~>"
185
185
  - !ruby/object:Gem::Version
186
- version: 0.51.0
186
+ version: 0.81.0
187
187
  - !ruby/object:Gem::Dependency
188
188
  name: yard
189
189
  requirement: !ruby/object:Gem::Requirement
@@ -205,10 +205,10 @@ description: |-
205
205
  stale Sensu clients
206
206
  email: "<sensu-users@googlegroups.com>"
207
207
  executables:
208
- - check-chef-nodes.rb
209
208
  - check-chef-node.rb
210
- - check-chef-server.rb
209
+ - check-chef-nodes.rb
211
210
  - handler-chef-node.rb
211
+ - check-chef-server.rb
212
212
  extensions: []
213
213
  extra_rdoc_files: []
214
214
  files:
@@ -246,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
246
246
  - !ruby/object:Gem::Version
247
247
  version: '0'
248
248
  requirements: []
249
- rubygems_version: 3.0.3
249
+ rubygems_version: 3.0.8
250
250
  signing_key:
251
251
  specification_version: 4
252
252
  summary: Sensu plugins for chef