bin/check-ses-statistics.rb in sensu-plugins-aws-2.4.1 vs bin/check-ses-statistics.rb in sensu-plugins-aws-2.4.2
- old
+ new
@@ -26,11 +26,11 @@
# Brandon Smith <freedom@reardencode.com>
# Released under the same terms as Sensu (the MIT license); see LICENSE
# for details.
require 'sensu-plugins-aws'
-require 'sensu-plugin/metric/cli'
+require 'sensu-plugin/check/cli'
require 'aws-sdk'
class CheckSesStatistics < Sensu::Plugin::Check::CLI
include Common
@@ -116,10 +116,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]
+ response.send_data_points.sort_by(&:timestamp).last
bounces = data_point.bounces
rejects = data_point.rejects
complaints = data_point.complaints
delivery_attempts = data_point.delivery_attempts