zabbix-cloudwatch
zabbix-cloudwatch copied to clipboard
Region immunity
After hours of debug I found some issue.
Environment: Ruby 2.0.0p645 Amazon Linux AMI release 2015.03 zabbix-cloudwatch 0.1.0
Problem: Always empty response with right request.
zabbix-cloudwatch --aws-access-key $AWSACCESSKEY --aws-secret-key $AWSSECRETKEY --aws-region eu-central-1 --namespace "AWS/RDS" --metricname FreeStorageSpace --dimension-name "DBInstanceIdentifier" --dimension-value somename
gives me nothing, just empty datapoint array.
Investigation:
I've been found similar issues when region is not set, so I checked. In main binary that's ok eu-central-1
, but when you going lower, to get_aws_options
function, there is if
with &&
which gives you on p options.key?"aws-region" && options['aws-region'] != ''
- false
. I can't understand why it's possible.
Solution:
I've changed &&
to and
and everything works. In this statement there is no difference between &&
and and
so it's ok.
http://devblog.avdi.org/2010/08/02/using-and-and-or-in-ruby/ good catch.
#7 should resolve this
Good! confirmed here the change from &&
to and
and now is working :+1: