bin/check-ses-limit.rb in sensu-plugins-aws-0.0.1.alpha.2 vs bin/check-ses-limit.rb in sensu-plugins-aws-0.0.1
- old
+ new
@@ -26,11 +26,10 @@
# Copyright (c) 2014, Joel <jjshoe@gmail.com>
# Released under the same terms as Sensu (the MIT license); see LICENSE
# for details.
#
-require 'rubygems' if RUBY_VERSION < '1.9.0'
require 'sensu-plugin/check/cli'
require 'aws/ses'
class CheckSESLimit < Sensu::Plugin::Check::CLI
option :aws_access_key,
@@ -73,10 +72,10 @@
response = ses.quota
rescue AWS::SES::ResponseError => e
critical "An issue occured while communicating with the AWS SES API: #{e.message}"
end
- unless response.empty?
+ unless response.empty? # rubocop: disable Style/GuardClause
percent = (response.sent_last_24_hours.to_i / response.max_24_hour_send.to_i) * 100
message = "SES sending limit is at #{percent}%"
if config[:crit_percent] > 0 && config[:crit_percent] <= percent
critical message