bin/check-jenkins.rb in sensu-plugins-jenkins-1.5.0 vs bin/check-jenkins.rb in sensu-plugins-jenkins-1.6.0
- old
+ new
@@ -56,13 +56,28 @@
long: '--https',
boolean: true,
description: 'Enabling https connections',
default: false
+ option :insecure,
+ short: '-k',
+ long: '--insecure',
+ boolean: true,
+ description: 'Perform "insecure" SSL connections and transfers.',
+ default: false
+
def run
https ||= config[:https] ? 'https' : 'http'
testurl = "#{https}://#{config[:server]}:#{config[:port]}#{config[:uri]}"
- r = RestClient::Resource.new(testurl, timeout: 5).get
+
+ r = if config[:https] && config[:insecure]
+ RestClient::Resource.new(testurl, timeout: 5, verify_ssl: false).get
+ elsif config[:https]
+ RestClient::Resource.new(testurl, timeout: 5, verify_ssl: true).get
+ else
+ RestClient::Resource.new(testurl, timeout: 5).get
+ end
+
if r.code == 200 && r.body.include?('pong')
ok 'Jenkins Service is up'
else
critical 'Jenkins Service is not responding'
end