zabbix-cloudwatch icon indicating copy to clipboard operation
zabbix-cloudwatch copied to clipboard

Strange getopt behaviour

Open vanch opened this issue 9 years ago • 2 comments

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".

vanch avatar Aug 26 '15 12:08 vanch

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 avatar Jan 29 '16 10:01 randywallace

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

randywallace avatar Jan 29 '16 10:01 randywallace