bin/zabbix-cloudwatch in zabbix-cloudwatch-0.1.0 vs bin/zabbix-cloudwatch in zabbix-cloudwatch-0.2.0
- old
+ new
@@ -7,20 +7,20 @@
require 'rubygems'
require 'zabbix-cloudwatch'
require 'getopt/long'
end
-@@aws_access_key=''
-@@aws_secret_key=''
-@@aws_region=''
+aws_access_key=''
+aws_secret_key=''
+aws_region=''
opts = Getopt::Long.getopts(
["--help"],
["--namespace", Getopt::REQUIRED],
["--metricname", Getopt::REQUIRED],
["--dimension-name", Getopt::REQUIRED],
- ["--dimension-value","-v", Getopt::REQUIRED],
+ ["--dimension-value", Getopt::REQUIRED],
["--monitoring-type", "-t", Getopt::REQUIRED],
["--statistic",Getopt::REQUIRED],
["--aws-access-key", Getopt::REQUIRED],
["--aws-secret-key", Getopt::REQUIRED],
["--aws-region", Getopt::REQUIRED],
@@ -34,11 +34,11 @@
-h, --help This Message
-n, --namespace Namespace (AWS/Autoscaling, AWS/EC2, etc...)
-m, --metricname Metric Name (GroupInServiceInstances,EstimatedCharges, etc...)
-d, --dimension-name Dimension Name (AutoScalingGroupName, etc...)
- -v, --dimension-value Dimension Value
+ --dimension-value Dimension Value
-t, --monitoring-type detailed|basic Default: basic
-s, --statistic Minimum|Maximum|Average|Sum|SampleCount Default: Average
--aws-access-key AWS Access Key
--aws-secret-key AWS Secret Key
--aws-region AWS Region Default: us-east-1
@@ -56,16 +56,16 @@
puts ZabbixCloudwatch::VERSION
exit 0
end
unless opts.key?"aws-access-key"
- opts["aws-access-key"] = (@@aws_access_key == '' && ENV["AWS_ACCESS_KEY_ID"]) || @@aws_access_key
+ opts["aws-access-key"] = (aws_access_key == '' && ENV["AWS_ACCESS_KEY_ID"]) || aws_access_key
end
unless opts.key?"aws-secret-key"
- opts["aws-secret-key"] = (@@aws_secret_key == '' && ENV["AWS_SECRET_ACCESS_KEY"]) || @@aws_secret_key
+ opts["aws-secret-key"] = (aws_secret_key == '' && ENV["AWS_SECRET_ACCESS_KEY"]) || aws_secret_key
end
unless opts.key?"aws-region"
- opts["aws-region"] = (@@aws_region == '' && ENV["AWS_REGION"]) || @@aws_region
+ opts["aws-region"] = (aws_region == '' && ENV["AWS_REGION"]) || aws_region
end
inst = ZabbixCloudwatch::GetCloudwatchMetric.new(opts)
inst.run!