sensu-plugins-puppet 2.2.0 → 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 +15 -1
- data/README.md +42 -1
- data/bin/check-puppet-errors.rb +9 -7
- data/bin/check-puppet-last-run.rb +40 -38
- data/bin/metrics-puppet-run.rb +5 -3
- data/lib/sensu-plugins-puppet.rb +2 -0
- data/lib/sensu-plugins-puppet/version.rb +4 -2
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a41cd72ab6037674334089e4582063a259b0893aeeb67589ff337dc874305fc
|
4
|
+
data.tar.gz: 86f3f7032b7548e76e181a30850c95d148aeef8c203fbb50e09e738ccac24625
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0f6b71451cdeefaaa9b6c17e604f844cbae5faac211473ea77b5cb947ca4cdf92e7ab449bfb5886170ea185391d67f4e45be46dd58104ccf9bdf1b0ae5c57bd
|
7
|
+
data.tar.gz: 6bdaa330d8d98fc1d297ba5bfa393a3e16f250ce11dc52022f1ca11079a3237a88bdd4650116720376f8ac55e9befe26bc02f36f3fec242e8729435d08d1ee39
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,19 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [3.0.0] - 2020-03-24
|
9
|
+
### Breaking Change
|
10
|
+
- Removed Ruby 2.1 and 2.2
|
11
|
+
- Updated sensu-plugin to '~> 4.0'
|
12
|
+
|
13
|
+
### Added
|
14
|
+
- Bonsai asset build bits
|
15
|
+
|
16
|
+
### Changed
|
17
|
+
- Updated bundler to '~> 2.1'
|
18
|
+
- Updated rubocop to '~> 0.80.1'
|
19
|
+
- Remediated rubocop warnings
|
20
|
+
|
8
21
|
## [2.2.0] - 2019-12-17
|
9
22
|
### Added
|
10
23
|
- Adding support windows by default without overriding options by checking the platform and adjusting the paths automatically (@bodgit)
|
@@ -64,7 +77,8 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
|
|
64
77
|
### Added
|
65
78
|
- initial release
|
66
79
|
|
67
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-puppet/compare/
|
80
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-puppet/compare/3.0.0...HEAD
|
81
|
+
[3.0.0]: https://github.com/sensu-plugins/sensu-plugins-puppet/compare/2.2.0...3.0.0
|
68
82
|
[2.2.0]: https://github.com/sensu-plugins/sensu-plugins-puppet/compare/2.1.1...2.2.0
|
69
83
|
[2.1.1]: https://github.com/sensu-plugins/sensu-plugins-puppet/compare/2.1.0...2.1.1
|
70
84
|
[2.1.0]: https://github.com/sensu-plugins/sensu-plugins-puppet/compare/2.0.0...2.1.0
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
## Sensu-Plugins-puppet
|
2
2
|
|
3
|
+
[![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-puppet)
|
3
4
|
[![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-puppet.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-puppet)
|
4
5
|
[![Gem Version](https://badge.fury.io/rb/sensu-plugins-puppet.svg)](http://badge.fury.io/rb/sensu-plugins-puppet)
|
5
6
|
[![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-puppet/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-puppet)
|
@@ -11,16 +12,56 @@
|
|
11
12
|
### check-puppet-last-run.rb
|
12
13
|
Validates Puppet last run. Alerts if last Puppet run was later than threshold or it has errors
|
13
14
|
|
15
|
+
```
|
16
|
+
Usage: ./bin/check-puppet-last-run.rb (options)
|
17
|
+
-a, --agent-disabled-file PATH Path to agent disabled lock file
|
18
|
+
-c, --crit-age SECONDS Age in seconds to be a critical
|
19
|
+
-C, --crit-age-disabled SECONDS Age in seconds to crit when agent is disabled
|
20
|
+
-d, --disabled-age-limits Consider disabled age limits, otherwise use main limits
|
21
|
+
-i, --ignore-failures Ignore Puppet failures
|
22
|
+
-r, --report-restart-failures Raise alerts if restart failures have happened
|
23
|
+
-s, --summary-file PATH Location of last_run_summary.yaml file
|
24
|
+
-w, --warn-age SECONDS Age in seconds to be a warning
|
25
|
+
-W, --warn-age-disabled SECONDS Age in seconds to warn when agent is disabled
|
26
|
+
|
27
|
+
```
|
28
|
+
|
14
29
|
### check-puppet-errors.rb
|
15
30
|
Validates only Puppet run errors regardless of the execution time
|
16
31
|
|
32
|
+
```
|
33
|
+
Usage: ./bin/check-puppet-errors.rb (options)
|
34
|
+
-a, --agent-disabled-file PATH Path to agent disabled lock file
|
35
|
+
-s, --summary-file PATH Location of last_run_summary.yaml file
|
36
|
+
```
|
37
|
+
|
38
|
+
### metrics-puppet-run.rb
|
39
|
+
Provides metrics from Puppet last run in graphite format.
|
40
|
+
|
41
|
+
```
|
42
|
+
Usage: ./bin/metrics-puppet-run.rb (options)
|
43
|
+
-s, --scheme SCHEME Metric naming scheme
|
44
|
+
-p, --summary-file PATH Location of last_run_summary.yaml file
|
45
|
+
```
|
46
|
+
|
17
47
|
## Files
|
18
48
|
|
19
49
|
* /bin/checkpuppet-last-run.rb
|
20
50
|
* /bin/metrics-puppet-run.rb
|
21
51
|
* /bin/check-puppet-errors.rb
|
22
52
|
|
23
|
-
|
53
|
+
|
54
|
+
## Installation Options
|
55
|
+
### Asset registration
|
56
|
+
|
57
|
+
Assets are the best way to make use of this plugin in Sensu Go. 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 latest version of this asset:
|
58
|
+
|
59
|
+
`sensuctl asset add sensu-plugins/sensu-plugins-puppet`
|
60
|
+
|
61
|
+
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-puupet).
|
62
|
+
|
63
|
+
|
64
|
+
### Gem Installation
|
24
65
|
|
25
66
|
[Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
|
26
67
|
|
data/bin/check-puppet-errors.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
#
|
3
5
|
# check-puppet-errors
|
4
6
|
#
|
@@ -35,15 +37,15 @@ require 'time'
|
|
35
37
|
|
36
38
|
class PuppetErrors < Sensu::Plugin::Check::CLI
|
37
39
|
option :summary_file,
|
38
|
-
short:
|
39
|
-
long:
|
40
|
-
default:
|
40
|
+
short: '-s PATH',
|
41
|
+
long: '--summary-file PATH',
|
42
|
+
default: SensuPluginsPuppet::SUMMARY_FILE,
|
41
43
|
description: 'Location of last_run_summary.yaml file'
|
42
44
|
|
43
45
|
option :agent_disabled_file,
|
44
|
-
short:
|
45
|
-
long:
|
46
|
-
default:
|
46
|
+
short: '-a PATH',
|
47
|
+
long: '--agent-disabled-file PATH',
|
48
|
+
default: SensuPluginsPuppet::AGENT_DISABLED_FILE,
|
47
49
|
description: 'Path to agent disabled lock file'
|
48
50
|
|
49
51
|
def run
|
@@ -73,7 +75,7 @@ class PuppetErrors < Sensu::Plugin::Check::CLI
|
|
73
75
|
end
|
74
76
|
end
|
75
77
|
|
76
|
-
if @failures > 0
|
78
|
+
if @failures > 0 # rubocop:disable Style/NumericPredicate
|
77
79
|
@message += " had #{@failures} failures"
|
78
80
|
critical @message
|
79
81
|
else
|
@@ -1,4 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
#
|
3
5
|
# check-puppet-last-run
|
4
6
|
#
|
@@ -35,64 +37,64 @@ require 'time'
|
|
35
37
|
|
36
38
|
class PuppetLastRun < Sensu::Plugin::Check::CLI
|
37
39
|
option :summary_file,
|
38
|
-
short:
|
39
|
-
long:
|
40
|
-
default:
|
40
|
+
short: '-s PATH',
|
41
|
+
long: '--summary-file PATH',
|
42
|
+
default: SensuPluginsPuppet::SUMMARY_FILE,
|
41
43
|
description: 'Location of last_run_summary.yaml file'
|
42
44
|
|
43
45
|
option :warn_age,
|
44
|
-
short:
|
45
|
-
long:
|
46
|
-
default:
|
47
|
-
proc:
|
46
|
+
short: '-w N',
|
47
|
+
long: '--warn-age SECONDS',
|
48
|
+
default: 3600,
|
49
|
+
proc: proc(&:to_i),
|
48
50
|
description: 'Age in seconds to be a warning'
|
49
51
|
|
50
52
|
option :crit_age,
|
51
|
-
short:
|
52
|
-
long:
|
53
|
-
default:
|
54
|
-
proc:
|
53
|
+
short: '-c N',
|
54
|
+
long: '--crit-age SECONDS',
|
55
|
+
default: 7200,
|
56
|
+
proc: proc(&:to_i),
|
55
57
|
description: 'Age in seconds to be a critical'
|
56
58
|
|
57
59
|
option :agent_disabled_file,
|
58
|
-
short:
|
59
|
-
long:
|
60
|
-
default:
|
60
|
+
short: '-a PATH',
|
61
|
+
long: '--agent-disabled-file PATH',
|
62
|
+
default: SensuPluginsPuppet::AGENT_DISABLED_FILE,
|
61
63
|
description: 'Path to agent disabled lock file'
|
62
64
|
|
63
65
|
option :disabled_age_limits,
|
64
|
-
short:
|
65
|
-
long:
|
66
|
-
boolean:
|
67
|
-
default:
|
66
|
+
short: '-d',
|
67
|
+
long: '--disabled-age-limits',
|
68
|
+
boolean: true,
|
69
|
+
default: false,
|
68
70
|
description: 'Consider disabled age limits, otherwise use main limits'
|
69
71
|
|
70
72
|
option :warn_age_disabled,
|
71
|
-
short:
|
72
|
-
long:
|
73
|
-
default:
|
74
|
-
proc:
|
73
|
+
short: '-W N',
|
74
|
+
long: '--warn-age-disabled SECONDS',
|
75
|
+
default: 3600,
|
76
|
+
proc: proc(&:to_i),
|
75
77
|
description: 'Age in seconds to warn when agent is disabled'
|
76
78
|
|
77
79
|
option :crit_age_disabled,
|
78
|
-
short:
|
79
|
-
long:
|
80
|
-
default:
|
81
|
-
proc:
|
80
|
+
short: '-C N',
|
81
|
+
long: '--crit-age-disabled SECONDS',
|
82
|
+
default: 7200,
|
83
|
+
proc: proc(&:to_i),
|
82
84
|
description: 'Age in seconds to crit when agent is disabled'
|
83
85
|
|
84
86
|
option :report_restart_failures,
|
85
|
-
short:
|
86
|
-
long:
|
87
|
-
boolean:
|
88
|
-
default:
|
87
|
+
short: '-r',
|
88
|
+
long: '--report-restart-failures',
|
89
|
+
boolean: true,
|
90
|
+
default: false,
|
89
91
|
description: 'Raise alerts if restart failures have happened'
|
90
92
|
|
91
93
|
option :ignore_failures,
|
92
|
-
short:
|
93
|
-
long:
|
94
|
-
boolean:
|
95
|
-
default:
|
94
|
+
short: '-i',
|
95
|
+
long: '--ignore-failures',
|
96
|
+
boolean: true,
|
97
|
+
default: false,
|
96
98
|
description: 'Ignore Puppet failures'
|
97
99
|
|
98
100
|
def run
|
@@ -138,11 +140,11 @@ class PuppetLastRun < Sensu::Plugin::Check::CLI
|
|
138
140
|
end
|
139
141
|
end
|
140
142
|
|
141
|
-
if @failures > 0
|
143
|
+
if @failures > 0 # rubocop:disable Style/NumericPredicate
|
142
144
|
@message += " with #{@failures} failures"
|
143
145
|
end
|
144
146
|
|
145
|
-
if @restart_failures > 0
|
147
|
+
if @restart_failures > 0 # rubocop:disable Style/NumericPredicate
|
146
148
|
@message += " with #{@restart_failures} restart failures"
|
147
149
|
end
|
148
150
|
|
@@ -156,7 +158,7 @@ class PuppetLastRun < Sensu::Plugin::Check::CLI
|
|
156
158
|
end
|
157
159
|
end
|
158
160
|
|
159
|
-
if @now - @last_run > config[:crit_age] || @failures > 0 || @restart_failures > 0
|
161
|
+
if @now - @last_run > config[:crit_age] || @failures > 0 || @restart_failures > 0 # rubocop:disable Style/NumericPredicate
|
160
162
|
critical @message
|
161
163
|
elsif @now - @last_run > config[:warn_age]
|
162
164
|
warning @message
|
@@ -170,7 +172,7 @@ class PuppetLastRun < Sensu::Plugin::Check::CLI
|
|
170
172
|
minutes = (total_seconds / 60) % 60
|
171
173
|
seconds = total_seconds % 60
|
172
174
|
|
173
|
-
if hours <= 0 && minutes > 0
|
175
|
+
if hours <= 0 && minutes > 0 # rubocop:disable Style/NumericPredicate
|
174
176
|
"#{minutes}m #{seconds}s"
|
175
177
|
elsif minutes <= 0
|
176
178
|
"#{seconds}s"
|
data/bin/metrics-puppet-run.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
#
|
3
5
|
# metrics-puppet-run
|
4
6
|
#
|
@@ -31,9 +33,9 @@ require 'socket'
|
|
31
33
|
|
32
34
|
class PuppetRun < Sensu::Plugin::Metric::CLI::Graphite
|
33
35
|
option :summary_file,
|
34
|
-
short:
|
35
|
-
long:
|
36
|
-
default:
|
36
|
+
short: '-p PATH',
|
37
|
+
long: '--summary-file PATH',
|
38
|
+
default: SensuPluginsPuppet::SUMMARY_FILE,
|
37
39
|
description: 'Location of last_run_summary.yaml file'
|
38
40
|
|
39
41
|
option :scheme,
|
data/lib/sensu-plugins-puppet.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-puppet
|
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:
|
11
|
+
date: 2020-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1
|
33
|
+
version: '2.1'
|
34
34
|
type: :development
|
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: '1
|
40
|
+
version: '2.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: codeclimate-test-reporter
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0.
|
131
|
+
version: 0.80.1
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0.
|
138
|
+
version: 0.80.1
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: yard
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -188,14 +188,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
188
188
|
requirements:
|
189
189
|
- - ">="
|
190
190
|
- !ruby/object:Gem::Version
|
191
|
-
version: 2.
|
191
|
+
version: '2.3'
|
192
192
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
193
|
requirements:
|
194
194
|
- - ">="
|
195
195
|
- !ruby/object:Gem::Version
|
196
196
|
version: '0'
|
197
197
|
requirements: []
|
198
|
-
|
198
|
+
rubyforge_project:
|
199
|
+
rubygems_version: 2.7.7
|
199
200
|
signing_key:
|
200
201
|
specification_version: 4
|
201
202
|
summary: Sensu plugins for puppet
|