randywallace / zabbix-cloudwatch

An external script for getting cloudwatch metrics into Zabbix
MIT License
27 stars 11 forks source link

Strange getopt behaviour #4

Open vanch opened 9 years ago

vanch commented 9 years ago

When I'm using your script like:

zabbix-cloudwatch --aws-access-key $AWSACCESSKEY --aws-secret-key $AWSSECRETKEY --aws-region $AWSREGION -n "AWS/RDS" -m CPUUtilization -d "DBInstanceIdentifier" -v somename

I'm getting message like

/usr/local/share/ruby/gems/2.0/gems/getopt-1.4.2/lib/getopt/long.rb:153:in `block in getopts': invalid switch 'somename' (Getopt::Long::Error)
        from /usr/local/share/ruby/gems/2.0/gems/getopt-1.4.2/lib/getopt/long.rb:91:in `each'
        from /usr/local/share/ruby/gems/2.0/gems/getopt-1.4.2/lib/getopt/long.rb:91:in `each_with_index'
        from /usr/local/share/ruby/gems/2.0/gems/getopt-1.4.2/lib/getopt/long.rb:91:in `getopts'
        from /usr/local/share/ruby/gems/2.0/gems/zabbix-cloudwatch-0.1.0/bin/zabbix-cloudwatch:16:in `<top (required)>'
        from /usr/local/bin/zabbix-cloudwatch:23:in `load'
        from /usr/local/bin/zabbix-cloudwatch:23:in `<main>'

The only solution I found is to use long option name like "--dimension-value".

randywallace commented 8 years ago

good catch, I ran into this as well. Not sure what to do about it now, b/c I would rather leave it as it is, b/c i don't know who would be affected by changing the flag name now

randywallace commented 8 years ago

took it out in #7, https://github.com/randywallace/zabbix-cloudwatch/commit/98137e8b95ae550b57e409723605ab87932b9339