bin/metrics-newrelic.rb in sensu-plugins-newrelic-boutetnico-1.1.0 vs bin/metrics-newrelic.rb in sensu-plugins-newrelic-boutetnico-1.1.1
- old
+ new
@@ -66,9 +66,12 @@
end
stats = Crack::XML.parse(res.body)
app = stats['accounts'].first['applications'].find { |v| v['name'] == config[:appname] }
+
+ warning 'NewRelic API sent an empty response' if app.nil?
+
app['threshold_values'].each do |v|
metric_name = v['name'].gsub(/\s+/, '_').downcase
output "#{config[:scheme]}.#{metric_name}", v['metric_value']
end