bin/metrics-ses.rb in sensu-plugins-aws-2.4.1 vs bin/metrics-ses.rb in sensu-plugins-aws-2.4.2
- old
+ new
@@ -49,10 +49,10 @@
response = ses.get_send_statistics
unknown 'Empty response from AWS SES API' if response.empty? # Can this happen?
unknown 'No data points from AWS SES API' if response.send_data_points.empty?
- data_point = response.send_data_points[-1]
+ data_point = response.send_data_points.sort_by(&:timestamp).last
output config[:scheme] + '.bounces', data_point.bounces
output config[:scheme] + '.rejects', data_point.rejects
output config[:scheme] + '.complaints', data_point.complaints
output config[:scheme] + '.delivery_attempts', data_point.delivery_attempts
end