lib/riemann/tools/apache_status.rb in riemann-tools-1.6.0 vs lib/riemann/tools/apache_status.rb in riemann-tools-1.7.0

- old
+ new

@@ -12,13 +12,14 @@ include Riemann::Tools require 'net/http' require 'uri' opt :uri, 'Apache Server Status URI', default: 'http://localhost/server-status' + opt :user_agent, 'User-Agent header for HTTP requests', short: :none, default: "#{File.basename($PROGRAM_NAME)}/#{Riemann::Tools::VERSION} (+https://github.com/riemann/riemann-tools)" def initialize - @uri = "#{URI.parse(opts[:uri])}?auto" + @uri = URI.parse("#{opts[:uri]}?auto") # Sample Response with ExtendedStatus On # Total Accesses: 20643 # Total kBytes: 36831 # CPULoad: .0180314 # Uptime: 43868 @@ -66,10 +67,10 @@ end def connection response = nil begin - response = ::Net::HTTP.get(@uri) + response = ::Net::HTTP.new(@uri.host, @uri.port).get(@uri, { 'user-agent' => opts[:user_agent] }).body rescue StandardError => e report( service: 'httpd health', state: 'critical', description: "Httpd connection error: #{e.class} - #{e.message}",