bin/riemann-nginx-status in riemann-tools-0.1.3 vs bin/riemann-nginx-status in riemann-tools-0.1.4

- old
+ new

@@ -47,10 +47,28 @@ return 'ok' end def tick - response = Net::HTTP.get(@uri) + response = nil + begin + response = Net::HTTP.get(@uri) + rescue => e + report( + :service => "nginx health", + :state => "critical", + :description => "Connection error: #{e.class} - #{e.message}" + ) + end + + return if response.nil? + + report( + :service => "nginx health", + :state => "ok", + :description => "Nginx status connection ok" + ) + values = @re.match(response).to_a[1,7].map { |v| v.to_i } @keys.zip(values).each do |key, value| report({ :service => "nginx #{key}",