bin/metrics-elasticache.rb in sensu-plugins-aws-0.0.4 vs bin/metrics-elasticache.rb in sensu-plugins-aws-1.0.0
- old
+ new
@@ -10,17 +10,16 @@
#
# PLATFORMS:
# Linux
#
# DEPENDENCIES:
-# gem: aws-sdk
+# gem: aws-sdk-v1
# gem: sensu-plugin
#
-# needs example command
# USAGE:
# #YELLOW
-
+#
# NOTES:
# Redis: http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CacheMetrics.Redis.html
# Memcached: http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CacheMetrics.Memcached.html
#
# By default fetches all available statistics from one minute ago. You may need to fetch further back than this;
@@ -67,27 +66,29 @@
proc: proc(&:to_i)
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"
+ 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: '-k 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"
+ 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 us-east-1).',
+ description: 'AWS Region (defaults to us-east-1).',
default: 'us-east-1'
def aws_config
- hash = {}
- hash.update access_key_id: config[:access_key_id], secret_access_key: config[:secret_access_key] if config[:access_key_id] && config[: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
if config[:scheme] == ''
graphitepath = "#{config[:elasticachename]}.#{config[:metric].downcase}"