sensu-plugins-jenkins 1.2.0 → 1.3.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 +5 -1
- data/bin/check-jenkins-job-status.rb +29 -11
- data/bin/check-jenkins.rb +2 -1
- data/lib/sensu-plugins-jenkins/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0ca38a46f4172586e2d186966e9e0f5966f18be
|
4
|
+
data.tar.gz: 58da9a11a763e44673a1c703177ffb016b678283
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e67ddbe8b75ecf76bcf9286cf9bfd950e48abf3472f8dd46b51d8295abcef8cd47051fbaf72e591dd96d979a2d24b83f3bf3aea665c7bcf05de27240fbab1203
|
7
|
+
data.tar.gz: e418d73135095b7b54d63cde12596bcd5bcfc08c78c9151ba984990307ab44578444a7d0d024495d3f22f84ac4265b31d23f3696728e9bfb1725ea46bf6386c8
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,9 @@ 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
|
+
## [1.3.0] - 2017-05-04
|
8
|
+
### Added
|
9
|
+
- Additional parameter -w to report unstable jobs as a Sensu warning
|
7
10
|
|
8
11
|
## [1.2.0] - 2016-11-11
|
9
12
|
### Added
|
@@ -56,7 +59,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
56
59
|
### Added
|
57
60
|
- initial release
|
58
61
|
|
59
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/1.
|
62
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/1.3.0...HEAD
|
63
|
+
[1.3.0]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/1.2.0...1.3.0
|
60
64
|
[1.2.0]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/1.1.0...1.2.0
|
61
65
|
[1.1.0]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/1.0.0...1.1.0
|
62
66
|
[1.0.0]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/0.1.0...1.0.0
|
@@ -66,11 +66,21 @@ class JenkinsJobChecker < Sensu::Plugin::Check::CLI
|
|
66
66
|
required: false,
|
67
67
|
default: ENV['JENKINS_PASS']
|
68
68
|
|
69
|
+
option :include_warnings,
|
70
|
+
description: 'whether to report unstable jobs as a warning',
|
71
|
+
short: '-w',
|
72
|
+
long: '--include-warnings',
|
73
|
+
boolean: true,
|
74
|
+
required: false,
|
75
|
+
default: false
|
76
|
+
|
69
77
|
def run
|
70
78
|
if failed_jobs.any?
|
71
|
-
critical "Jobs reporting failure: #{
|
79
|
+
critical "Jobs reporting failure: #{failed_job_names}, jobs reported as unstable: #{unstable_job_names}"
|
80
|
+
elsif unstable_jobs.any? && config[:include_warnings]
|
81
|
+
warning "Jobs reported as unstable: #{unstable_job_names}"
|
72
82
|
else
|
73
|
-
ok 'All queried jobs
|
83
|
+
ok 'All queried jobs report success'
|
74
84
|
end
|
75
85
|
end
|
76
86
|
|
@@ -85,15 +95,15 @@ class JenkinsJobChecker < Sensu::Plugin::Check::CLI
|
|
85
95
|
end
|
86
96
|
|
87
97
|
def jobs_statuses
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
98
|
+
@job_listing ||=
|
99
|
+
if config[:job_list] =~ /\^/
|
100
|
+
jenkins_api_client.job.list(config[:job_list]).reduce({}) do |listing, job_name| # rubocop:disable Style/EachWithObject
|
101
|
+
listing[job_name] = job_status(job_name)
|
102
|
+
listing
|
103
|
+
end
|
104
|
+
else
|
105
|
+
{ config[:job_list] => job_status(config[:job_list]) }
|
93
106
|
end
|
94
|
-
else
|
95
|
-
{ config[:job_list] => job_status(config[:job_list]) }
|
96
|
-
end
|
97
107
|
end
|
98
108
|
|
99
109
|
def job_status(job_name)
|
@@ -109,11 +119,19 @@ class JenkinsJobChecker < Sensu::Plugin::Check::CLI
|
|
109
119
|
critical "Error looking up Jenkins job: #{job_name}"
|
110
120
|
end
|
111
121
|
|
122
|
+
def unstable_jobs
|
123
|
+
jobs_statuses.select { |_job_name, status| status == 'unstable' }
|
124
|
+
end
|
125
|
+
|
112
126
|
def failed_jobs
|
113
127
|
jobs_statuses.select { |_job_name, status| status == 'failure' }
|
114
128
|
end
|
115
129
|
|
116
|
-
def
|
130
|
+
def unstable_job_names
|
131
|
+
unstable_jobs.keys.join(', ')
|
132
|
+
end
|
133
|
+
|
134
|
+
def failed_job_names
|
117
135
|
failed_jobs.keys.join(', ')
|
118
136
|
end
|
119
137
|
end
|
data/bin/check-jenkins.rb
CHANGED
@@ -60,7 +60,8 @@ class JenkinsMetricsPingPongChecker < Sensu::Plugin::Check::CLI
|
|
60
60
|
|
61
61
|
def run
|
62
62
|
https ||= config[:https] ? 'https' : 'http'
|
63
|
-
|
63
|
+
testurl = "#{https}://#{config[:server]}:#{config[:port]}#{config[:uri]}"
|
64
|
+
r = RestClient::Resource.new(testurl, timeout: 5).get
|
64
65
|
if r.code == 200 && r.body.include?('pong')
|
65
66
|
ok 'Jenkins Service is up'
|
66
67
|
else
|
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.
|
4
|
+
version: 1.3.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: 2017-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|