sensu-plugins-puppet 0.0.2 → 1.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: 18b09134fb3b885779006792bb280f84493d3b83
4
- data.tar.gz: 6457403b00bef329c09d94bb15b00cd5a9f169c4
3
+ metadata.gz: 512d447b438befcfa36655be7c9f0c55b8032531
4
+ data.tar.gz: a2410af007ec18fea9badd6f8e595f374f36cd30
5
5
  SHA512:
6
- metadata.gz: 391421b0b1c0f8bd6a13a6811554c303a35011172c23446e7231eb32d9370bd10f1def03a07d3205255c2283645e16c5ccc691f8b54638666ccf972d22f2f251
7
- data.tar.gz: c992a0ca78d879c5d2649bbcf2a458935c6482627ddf9ee9b89dee04a43d9b21c990970c21fd65254ebfdc5701ea5455261c504e3d6a68b80b8362e462981fb7
6
+ metadata.gz: 9faf85ef60b975a7daaaae7e3c885a1af0e6317a7af2cccbff8ff93f76265814eb185a56e4c487d13bcd5405216f0c4fa3e6acdcdf2a38448d7f90c72ff0a3be
7
+ data.tar.gz: fb13308fb2154842e0d92063f7c991dba54d468e9307397e8ace1c1e89148360b9c8b91c72c09f023ed13e25bbfec1c996dc25a72e06bddaa43bc902a26760ea
data/CHANGELOG.md CHANGED
@@ -3,14 +3,27 @@ This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
- ## Unreleased][unreleased]
6
+ ## [Unreleased]
7
+
8
+ ## [1.0.0] - 2016-06-21
9
+ ### Changed
10
+ - check-puppet-last-run.rb: Added a formatter method to display time in a more human friendly format. (d m s) ago
11
+ - check-puppet-last-run.rb: if the agent is disabled via lock file, display reason (if available)
12
+ - Loosened dependency on sensu-plugin from `= 1.2.0` to `~> 1.2.0`
13
+ - Updated Rubocop to 0.40, applied auto-correct
14
+ - check-puppet-last-run.rb: now returns critical when errors are found in the puppet run
15
+
16
+ ### Removed
17
+ - Remove Ruby 1.9.3 support; add Ruby 2.2.0 and 2.3.0 support to test matrix.
7
18
 
8
19
  ## [0.0.2] - 2015-07-14
9
20
  ### Changed
10
21
  - updated sensu-plugin gem to 1.2.0
11
22
 
12
23
  ## [0.0.1] - 2015-07-04
13
-
14
24
  ### Added
15
25
  - initial release
16
26
 
27
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-puppet/compare/1.0.0...HEAD
28
+ [1.0.0]: https://github.com/sensu-plugins/sensu-plugins-puppet/compare/0.0.2...1.0.0
29
+ [0.0.2]: https://github.com/sensu-plugins/sensu-plugins-puppet/compare/0.0.1...0.0.2
data/README.md CHANGED
@@ -5,7 +5,6 @@
5
5
  [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-puppet/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-puppet)
6
6
  [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-puppet/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-puppet)
7
7
  [![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-puppet.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-puppet)
8
- [![Codeship Status for sensu-plugins/sensu-plugins-puppet](https://codeship.com/projects/0ab767d0-049f-0133-7be5-52ca95efad4a/status?branch=master)](https://codeship.com/projects/89385)
9
8
 
10
9
  ## Functionality
11
10
 
@@ -18,6 +17,8 @@
18
17
 
19
18
  ## Installation
20
19
 
21
- [Installation and Setup](https://github.com/sensu-plugins/documentation/blob/master/user_docs/installation_instructions.md)
20
+ [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
22
21
 
23
22
  ## Notes
23
+
24
+ As the sensu user doesn't have read access to `/opt/puppetlabs/puppet/cache/state/last_run_summary.yaml` it is necessary to create an appropriate entry in `/etc/sudoers.d` and call `check-puppet-last-run.rb` or `metrics-puppet-run.rb` using `sudo`.
@@ -29,6 +29,7 @@
29
29
 
30
30
  require 'sensu-plugin/check/cli'
31
31
  require 'yaml'
32
+ require 'json'
32
33
  require 'time'
33
34
 
34
35
  class PuppetLastRun < Sensu::Plugin::Check::CLI
@@ -52,6 +53,12 @@ class PuppetLastRun < Sensu::Plugin::Check::CLI
52
53
  proc: proc(&:to_i),
53
54
  description: 'Age in seconds to be a critical'
54
55
 
56
+ option :agent_disabled_file,
57
+ short: '-a PATH',
58
+ long: '--agent-disabled-file PATH',
59
+ default: '/opt/puppetlabs/puppet/cache/state/agent_disabled.lock',
60
+ description: 'Path to agent disabled lock file'
61
+
55
62
  def run
56
63
  unless File.exist?(config[:summary_file])
57
64
  unknown "File #{config[:summary_file]} not found"
@@ -62,13 +69,25 @@ class PuppetLastRun < Sensu::Plugin::Check::CLI
62
69
  begin
63
70
  summary = YAML.load_file(config[:summary_file])
64
71
  @last_run = summary['time']['last_run'].to_i
72
+ @failures = summary['events']['failures'].to_i
65
73
  rescue
66
74
  unknown "Could not process #{config[:summary_file]}"
67
75
  end
68
76
 
69
- @message = "Puppet last run #{@now - @last_run} seconds ago"
77
+ @message = "Puppet last run #{formatted_duration(@now - @last_run)} ago"
78
+
79
+ begin
80
+ disabled_message = JSON.parse(File.read(config[:agent_disabled_file]))['disabled_message']
81
+ @message += " (disabled reason: #{disabled_message})"
82
+ rescue # rubocop:disable HandleExceptions
83
+ # fail silently
84
+ end
85
+
86
+ if @failures > 0
87
+ @message += " with #{@failures} failures"
88
+ end
70
89
 
71
- if @now - @last_run > config[:crit_age]
90
+ if @now - @last_run > config[:crit_age] || @failures > 0
72
91
  critical @message
73
92
  elsif @now - @last_run > config[:warn_age]
74
93
  warning @message
@@ -76,4 +95,18 @@ class PuppetLastRun < Sensu::Plugin::Check::CLI
76
95
  ok @message
77
96
  end
78
97
  end
98
+
99
+ def formatted_duration(total_seconds)
100
+ hours = total_seconds / (60 * 60)
101
+ minutes = (total_seconds / 60) % 60
102
+ seconds = total_seconds % 60
103
+
104
+ if hours <= 0 && minutes > 0
105
+ "#{minutes}m #{seconds}s"
106
+ elsif minutes <= 0
107
+ "#{seconds}s"
108
+ else
109
+ "#{hours}h #{minutes}m #{seconds}s"
110
+ end
111
+ end
79
112
  end
@@ -2,9 +2,9 @@
2
2
  module SensuPluginsPuppet
3
3
  # This defines the version of the gem
4
4
  module Version
5
- MAJOR = 0
5
+ MAJOR = 1
6
6
  MINOR = 0
7
- PATCH = 2
7
+ PATCH = 0
8
8
 
9
9
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
10
10
  end
metadata CHANGED
@@ -1,51 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDgDCCAmigAwIBAgIBATANBgkqhkiG9w0BAQUFADBDMRIwEAYDVQQDDAltYXR0
14
- am9uZXMxGDAWBgoJkiaJk/IsZAEZFgh5aWVsZGJvdDETMBEGCgmSJomT8ixkARkW
15
- A2NvbTAeFw0xNTAxMjgyMTAyNTFaFw0xNjAxMjgyMTAyNTFaMEMxEjAQBgNVBAMM
16
- CW1hdHRqb25lczEYMBYGCgmSJomT8ixkARkWCHlpZWxkYm90MRMwEQYKCZImiZPy
17
- LGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyTSzVYnO
18
- CLgyrIyT1mBQakArQyW8xhi6MlDqyzXHJGeERT790U6EgoBVeS4XoK0ptFZNR8Tf
19
- zko0w+Nv47TarSCgkPOaxY+mxWnAVR10dOmfeLr7huiMyps+YD56/EF2FqQ3jf/+
20
- qohENfKD91qy1ieEy+Fn7Pf74ltbNKUdkb9a9eFXQ0DQ4ip5vik7DzjQkUTj4lca
21
- k6ArwnmHX4YDhZoYtrQJ8jVktN0/+NtA40M5qkCYHNe5tUW25b/tKVYuioxG6b2Z
22
- oIzaZxRLxf6HVAWpCVRT/F5+/yjigkX4u++eYacfLGleXQzoK7BL65vHGMJygWEE
23
- 0TKGqFOrl/L0AQIDAQABo38wfTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNV
24
- HQ4EFgQUEf6a8Td7MrSZc8ImbLFZAENPbz0wIQYDVR0RBBowGIEWbWF0dGpvbmVz
25
- QHlpZWxkYm90LmNvbTAhBgNVHRIEGjAYgRZtYXR0am9uZXNAeWllbGRib3QuY29t
26
- MA0GCSqGSIb3DQEBBQUAA4IBAQBbzXAYA3BVGw8DZ0YYoY1VHPNEcH5qPIApmHO8
27
- rvSmuUT0yMEi7u00H/5uHRFf4LleGT/+sTdyXKsNPGT9kdRuQEgwi+vf7Zfvd8aX
28
- UF/+4VkEYf/8rV8Ere6u2QaWPgApdMV6JjKr1fAwCTd8AuGXNaWItiPPMseSQzLJ
29
- JKP4hVvbc1d+oS925B1lcBiqn2aYvElbyNAVmQPywNNqkWmvtlqj9ZVJfV5HQLdu
30
- 8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
- HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
- -----END CERTIFICATE-----
33
- date: 2015-07-14 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2016-06-21 00:00:00.000000000 Z
34
12
  dependencies:
35
13
  - !ruby/object:Gem::Dependency
36
14
  name: sensu-plugin
37
15
  requirement: !ruby/object:Gem::Requirement
38
16
  requirements:
39
- - - '='
17
+ - - "~>"
40
18
  - !ruby/object:Gem::Version
41
- version: 1.2.0
19
+ version: '1.2'
42
20
  type: :runtime
43
21
  prerelease: false
44
22
  version_requirements: !ruby/object:Gem::Requirement
45
23
  requirements:
46
- - - '='
24
+ - - "~>"
47
25
  - !ruby/object:Gem::Version
48
- version: 1.2.0
26
+ version: '1.2'
49
27
  - !ruby/object:Gem::Dependency
50
28
  name: bundler
51
29
  requirement: !ruby/object:Gem::Requirement
@@ -106,16 +84,16 @@ dependencies:
106
84
  name: rubocop
107
85
  requirement: !ruby/object:Gem::Requirement
108
86
  requirements:
109
- - - '='
87
+ - - "~>"
110
88
  - !ruby/object:Gem::Version
111
- version: '0.30'
89
+ version: 0.40.0
112
90
  type: :development
113
91
  prerelease: false
114
92
  version_requirements: !ruby/object:Gem::Requirement
115
93
  requirements:
116
- - - '='
94
+ - - "~>"
117
95
  - !ruby/object:Gem::Version
118
- version: '0.30'
96
+ version: 0.40.0
119
97
  - !ruby/object:Gem::Dependency
120
98
  name: rspec
121
99
  requirement: !ruby/object:Gem::Requirement
@@ -172,11 +150,14 @@ dependencies:
172
150
  - - "~>"
173
151
  - !ruby/object:Gem::Version
174
152
  version: '0.8'
175
- description: Sensu puppet plugins
153
+ description: |-
154
+ This plugin provides native Puppet instrumentation
155
+ for monitoring and metrics collection for the last
156
+ Puppet run.
176
157
  email: "<sensu-users@googlegroups.com>"
177
158
  executables:
178
- - metrics-puppet-run.rb
179
159
  - check-puppet-last-run.rb
160
+ - metrics-puppet-run.rb
180
161
  extensions: []
181
162
  extra_rdoc_files: []
182
163
  files:
@@ -205,7 +186,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
205
186
  requirements:
206
187
  - - ">="
207
188
  - !ruby/object:Gem::Version
208
- version: 1.9.3
189
+ version: 2.0.0
209
190
  required_rubygems_version: !ruby/object:Gem::Requirement
210
191
  requirements:
211
192
  - - ">="
@@ -213,8 +194,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
213
194
  version: '0'
214
195
  requirements: []
215
196
  rubyforge_project:
216
- rubygems_version: 2.4.6
197
+ rubygems_version: 2.5.1
217
198
  signing_key:
218
199
  specification_version: 4
219
200
  summary: Sensu plugins for puppet
220
201
  test_files: []
202
+ has_rdoc:
checksums.yaml.gz.sig DELETED
Binary file
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
@@ -1,3 +0,0 @@
1
- ��=�DR���g�C
2
- xr�_�@����� Y�P�?瘲�T��ϖ8!#�)4Y��+�B�2�s��F���m�uiS怨�(d�c3�.�QJ'H"Z!J�aS��.ʝE�G�d��о��?wX��PE�ѤpH.�;��nB*��f��w�0㧊��A�=��:�ƨ
3
- 9^p봘���}*�O�Ѣ�V��9k�5��{�|� �6ʵ�8�mG+oWd��6u���%]���po���_