bin/check-elb-certs.rb in sensu-plugins-aws-0.0.4 vs bin/check-elb-certs.rb in sensu-plugins-aws-1.0.0

- old
+ new

@@ -11,14 +11,12 @@ # # PLATFORMS: # Linux # # DEPENDENCIES: -# gem: aws-sdk +# gem: aws-sdk-v1 # gem: sensu-plugin -# gem: openssl -# gem: net/http # # USAGE: # ./check-ec2-network.rb -r ${you_region} -i ${your_instance_id} --warning-over 1000000 --critical-over 1500000 # ./check-ec2-network.rb -r ${you_region} -i ${your_instance_id} -d NetworkIn --warning-over 1000000 --critical-over 1500000 # ./check-ec2-network.rb -r ${you_region} -i ${your_instance_id} -d NetworkOut --warning-over 1000000 --critical-over 1500000 @@ -38,23 +36,23 @@ class CheckELBCerts < Sensu::Plugin::Check::CLI option :aws_access_key, short: '-a AWS_ACCESS_KEY', long: '--aws-access-key AWS_ACCESS_KEY', - description: "AWS Access Key. Either set ENV['AWS_ACCESS_KEY_ID'] or provide it as an option", - default: ENV['AWS_ACCESS_KEY_ID'] + description: "AWS Access Key. Either set ENV['AWS_ACCESS_KEY'] or provide it as an option", + default: ENV['AWS_ACCESS_KEY'] option :aws_secret_access_key, - short: '-s AWS_SECRET_ACCESS_KEY', - long: '--aws-secret-access-key AWS_SECRET_ACCESS_KEY', - description: "AWS Secret Access Key. Either set ENV['AWS_SECRET_ACCESS_KEY'] or provide it as an option", - default: ENV['AWS_SECRET_ACCESS_KEY'] + short: '-k AWS_SECRET_KEY', + long: '--aws-secret-access-key AWS_SECRET_KEY', + description: "AWS Secret Access Key. Either set ENV['AWS_SECRET_KEY'] or provide it as an option", + default: ENV['AWS_SECRET_KEY'] option :aws_region, short: '-r AWS_REGION', long: '--aws-region REGION', - description: 'AWS Region (such as eu-west-1).', + description: 'AWS Region (defaults to us-east-1).', default: 'us-east-1' option :warn_under, short: '-w WARN_NUM', long: '--warn WARN_NUM', @@ -80,14 +78,13 @@ message += "#{descriptor} #{limit} day" message += (limit == 1 ? '' : 's') # rubocop:disable UselessAssignment end def aws_config - hash = {} - hash.update access_key_id: config[:aws_access_key], secret_access_key: config[:aws_secret_access_key]\ - if config[:aws_access_key] && config[:aws_secret_access_key] - hash.update region: config[:aws_region] - hash + { access_key_id: config[:aws_access_key], + secret_access_key: config[:aws_secret_access_key], + region: config[:aws_region] + } end def run # rubocop:disable all ok_message = [] warning_message = []