bin/check-jenkins.rb in sensu-plugins-jenkins-1.6.2 vs bin/check-jenkins.rb in sensu-plugins-jenkins-1.7.0

- old
+ new

@@ -63,19 +63,26 @@ long: '--insecure', boolean: true, description: 'Perform "insecure" SSL connections and transfers.', default: false + option :timeout, + short: '-t SECONDS', + long: '--timeout SECONDS', + description: 'Timeout for REST request', + proc: proc(&:to_i), + default: 5 + def run https ||= config[:https] ? 'https' : 'http' testurl = "#{https}://#{config[:server]}:#{config[:port]}#{config[:uri]}" r = if config[:https] && config[:insecure] - RestClient::Resource.new(testurl, timeout: 5, verify_ssl: false).get + RestClient::Resource.new(testurl, timeout: config[:timeout], verify_ssl: false).get elsif config[:https] - RestClient::Resource.new(testurl, timeout: 5, verify_ssl: true).get + RestClient::Resource.new(testurl, timeout: config[:timeout], verify_ssl: true).get else - RestClient::Resource.new(testurl, timeout: 5).get + RestClient::Resource.new(testurl, timeout: config[:timeout]).get end if r.code == 200 && r.body.include?('pong') ok 'Jenkins Service is up' else