bin/check-http-json.rb in sensu-plugins-http-2.8.0 vs bin/check-http-json.rb in sensu-plugins-http-2.8.1
- old
+ new
@@ -1,6 +1,8 @@
#!/usr/bin/env ruby
+# frozen_string_literal: true
+
#
# check-http-json
#
# DESCRIPTION:
# Takes either a URL or a combination of host/path/query/port/ssl, and checks
@@ -88,11 +90,11 @@
Timeout.timeout(config[:timeout]) do
acquire_resource
end
rescue Timeout::Error
critical 'Connection timed out'
- rescue => e
+ rescue StandardError => e
critical "Connection error: #{e.message}"
end
end
def deep_value(data, desired_key, parent = '')
@@ -200,10 +202,10 @@
raise "unexpected value for key: '#{leaf}' not < '#{config[:valueLt]}'" unless leaf.to_f < config[:valueLt].to_f
message += "less than '#{config[:valueLt]}'"
end
ok message
- rescue => e
+ rescue StandardError => e
if config[:dump_json]
json_response = config[:pretty] ? JSON.pretty_generate(json) : json
message = "key check failed: #{e}. Response: #{json_response}"
else
message = "key check failed: #{e}"