bin/check-jenkins.rb in sensu-plugins-jenkins-0.0.2 vs bin/check-jenkins.rb in sensu-plugins-jenkins-0.0.3
- old
+ new
@@ -37,17 +37,31 @@
description: 'Jenkins Host',
short: '-s SERVER',
long: '--server SERVER',
default: 'localhost'
+ option :port,
+ description: 'Jenkins Port',
+ short: 'p PORT',
+ long: '--port PORT',
+ default: '8080'
+
option :uri,
description: 'Jenkins Metrics Ping URI',
short: '-u URI',
long: '--uri URI',
default: 'metrics/currentUser/ping'
+ option :https,
+ short: '-h',
+ long: '--https',
+ boolean: true,
+ description: 'Enabling https connections',
+ default: false
+
def run
- r = RestClient::Resource.new("http://#{config[:server]}:8080/#{config[:uri]}", timeout: 5).get
+ https ||= config[:https] ? 'https' : 'http'
+ r = RestClient::Resource.new("#{https}://#{config[:server]}:#{config[:port]}#{config[:uri]}", timeout: 5).get
if r.code == 200 && r.body.include?('pong')
ok 'Jenkins Service is up'
else
critical 'Jenkins Service is not responding'
end