sensu-plugins-jenkins 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a0ca38a46f4172586e2d186966e9e0f5966f18be
4
- data.tar.gz: 58da9a11a763e44673a1c703177ffb016b678283
2
+ SHA256:
3
+ metadata.gz: 808c6c898fd67ddbe4a946441a22aacee8927489c12c2f377f22ec7263068f8d
4
+ data.tar.gz: da62671dfa2c8fac2c7c78f27ac07f9aaa671fa0700ebe6eb534353dac524b07
5
5
  SHA512:
6
- metadata.gz: e67ddbe8b75ecf76bcf9286cf9bfd950e48abf3472f8dd46b51d8295abcef8cd47051fbaf72e591dd96d979a2d24b83f3bf3aea665c7bcf05de27240fbab1203
7
- data.tar.gz: e418d73135095b7b54d63cde12596bcd5bcfc08c78c9151ba984990307ab44578444a7d0d024495d3f22f84ac4265b31d23f3696728e9bfb1725ea46bf6386c8
6
+ metadata.gz: 8c88f5c1c5605bdd7d575c27f61814d86878de36a34fc2de083e6862972003cf110713eb1b09fb8d1ca4d7c50e51882bacfc13137b10cac5e96600c2c59624e7
7
+ data.tar.gz: 1534e1c13baa8ddf7938b3ceb4025749634655917d48f49d1b280551165ff1309606e0502e4f59a5e8d2fb23d3c493e77f79f89cd2431217627721ca63cf35de
data/CHANGELOG.md CHANGED
@@ -1,9 +1,23 @@
1
- #Change Log
1
+ # Change Log
2
2
  This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
- This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
4
+ This CHANGELOG follows the format listed at [Our CHANGELOG Guidelines](https://github.com/sensu-plugins/community/blob/master/HOW_WE_CHANGELOG.md).
5
+ Which is based on [Keep A Changelog](http://keepachangelog.com/)
5
6
 
6
7
  ## [Unreleased]
8
+
9
+ ## [1.4.0] - 2017-11-15
10
+ ### Added
11
+ - Add Ruby 2.4.1 testing
12
+ - metrics-jenkins.rb: Add --timeout parameter + report of the request duration
13
+
14
+ ### Fixed
15
+ - lock dependency on `rb-readline` to remove deprecation warnings about fixnum (@majormoses)
16
+ - metrics-jenkins.rb: timeout not timing out properly
17
+
18
+ ### Changed
19
+ - update changelog format location (@majormoses)
20
+
7
21
  ## [1.3.0] - 2017-05-04
8
22
  ### Added
9
23
  - Additional parameter -w to report unstable jobs as a Sensu warning
@@ -59,7 +73,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
59
73
  ### Added
60
74
  - initial release
61
75
 
62
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/1.3.0...HEAD
76
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/1.4.0...HEAD
77
+ [1.4.0]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/1.3.0...1.4.0
63
78
  [1.3.0]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/1.2.0...1.3.0
64
79
  [1.2.0]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/1.1.0...1.2.0
65
80
  [1.1.0]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/1.0.0...1.1.0
@@ -71,10 +71,33 @@ class JenkinsMetrics < Sensu::Plugin::Metric::CLI::Graphite
71
71
  description: 'Enabling https connections',
72
72
  default: false
73
73
 
74
+ option :timeout,
75
+ short: '-t SECONDS',
76
+ long: '--timeout SECONDS',
77
+ description: 'Timeout for REST request',
78
+ proc: proc(&:to_i),
79
+ default: 10
80
+
81
+ option :report_request_duration,
82
+ long: '--[no-]report-request-duration',
83
+ boolean: true,
84
+ description: 'Report the duration of the REST request',
85
+ default: true
86
+
87
+ def report_request_duration
88
+ return unless config[:report_request_duration]
89
+ @stop ||= DateTime.now
90
+ ms = ((@stop - @start) * 1000 * 24 * 60 * 60).to_i
91
+ output("#{config[:scheme]}.request.duration", ms)
92
+ end
93
+
74
94
  def run
95
+ @start = DateTime.now
96
+ @stop = nil
75
97
  begin
76
98
  https ||= config[:https] ? 'https' : 'http'
77
- r = RestClient::Resource.new("#{https}://#{config[:server]}:#{config[:port]}#{config[:uri]}", timeout: 5).get
99
+ r = RestClient::Resource.new("#{https}://#{config[:server]}:#{config[:port]}#{config[:uri]}", timeout: config[:timeout]).get
100
+ @stop = DateTime.now
78
101
  all_metrics = JSON.parse(r)
79
102
  metric_groups = all_metrics.keys - SKIP_ROOT_KEYS
80
103
  metric_groups.each do |metric_groups_key|
@@ -87,9 +110,13 @@ class JenkinsMetrics < Sensu::Plugin::Metric::CLI::Graphite
87
110
  end
88
111
  ok
89
112
  rescue Errno::ECONNREFUSED
90
- critical 'Jenkins is not responding'
113
+ STDERR.write "Jenkins is not responding\n"
114
+ critical
91
115
  rescue RestClient::RequestTimeout
92
- critical 'Jenkins Connection timed out'
116
+ STDERR.write "Jenkins Connection timed out\n"
117
+ critical
118
+ ensure
119
+ report_request_duration
93
120
  end
94
121
  ok
95
122
  end
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsJenkins
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 3
4
+ MINOR = 4
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-jenkins
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.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-05-05 00:00:00.000000000 Z
11
+ date: 2017-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 1.8.0
33
+ version: 2.0.2
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: 1.8.0
40
+ version: 2.0.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: jenkins_api_client
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +66,26 @@ dependencies:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.10.6
69
+ - !ruby/object:Gem::Dependency
70
+ name: rb-readline
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 0.5.5
76
+ - - "<="
77
+ - !ruby/object:Gem::Version
78
+ version: '1.0'
79
+ type: :runtime
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: 0.5.5
86
+ - - "<="
87
+ - !ruby/object:Gem::Version
88
+ version: '1.0'
69
89
  - !ruby/object:Gem::Dependency
70
90
  name: bundler
71
91
  requirement: !ruby/object:Gem::Requirement
@@ -244,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
264
  version: '0'
245
265
  requirements: []
246
266
  rubyforge_project:
247
- rubygems_version: 2.4.8
267
+ rubygems_version: 2.7.2
248
268
  signing_key:
249
269
  specification_version: 4
250
270
  summary: Sensu plugins for jenkins