bin/check-http.rb in sensu-plugins-http-0.1.2 vs bin/check-http.rb in sensu-plugins-http-0.2.0
- old
+ new
@@ -188,20 +188,23 @@
rescue => e
critical "Request error: #{e.message}"
end
end
- def acquire_resource # rubocop:disable all
+ def acquire_resource
http = nil
if config[:no_proxy]
http = Net::HTTP.new(config[:host], config[:port], nil, nil)
elsif config[:proxy_url]
proxy_uri = URI.parse(config[:proxy_url])
http = Net::HTTP.new(config[:host], config[:port], proxy_uri.host, proxy_uri.port)
else
http = Net::HTTP.new(config[:host], config[:port])
end
+ http.read_timeout = config[:timeout]
+ http.open_timeout = config[:timeout]
+ http.ssl_timeout = config[:timeout]
warn_cert_expire = nil
if config[:ssl]
http.use_ssl = true
if config[:cert]