randywallace / zabbix-cloudwatch

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

Give me example, get CPU Utilization on ec2 instance #10

Open fatgit opened 8 years ago

fatgit commented 8 years ago

Please, give me example as I can get "CPU Utilization" from ec2 instance I try /usr/local/bin/zabbix-cloudwatch -n AWS/EC2 -m CPUUtilization -d i-d336b210 --aws-access-key MY_ACCESS --aws-secret-key MY_SECRET --aws-region us-west-1

but have error

lbardelli commented 8 years ago

I also try: zabbix-cloudwatch --aws-access-key $AWSACCESSKEY --aws-secret-key $AWSSECRETKEY --aws-region eu-west-1 --namespace AWS/EC2 --metricname CPUUtilization --dimension-name InstanceId i-6a80xxx

And I get a list of errors:

/usr/local/rvm/gems/ruby-2.1.8/gems/getopt-1.4.3/lib/getopt/long.rb:152:in block in getopts': invalid switch 'i-6a80e1e2' (Getopt::Long::Error) from /usr/local/rvm/gems/ruby-2.1.8/gems/getopt-1.4.3/lib/getopt/long.rb:91:ineach' from /usr/local/rvm/gems/ruby-2.1.8/gems/getopt-1.4.3/lib/getopt/long.rb:91:in each_with_index' from /usr/local/rvm/gems/ruby-2.1.8/gems/getopt-1.4.3/lib/getopt/long.rb:91:ingetopts' from /usr/local/zabbix-cloudwatch/bin/zabbix-cloudwatch:16:in <top (required)>' from /usr/local/rvm/gems/ruby-2.1.8/bin/zabbix-cloudwatch:23:inload' from /usr/local/rvm/gems/ruby-2.1.8/bin/zabbix-cloudwatch:23:in <main>' from /usr/local/rvm/gems/ruby-2.1.8/bin/ruby_executable_hooks:15:ineval' from /usr/local/rvm/gems/ruby-2.1.8/bin/ruby_executable_hooks:15:in `

'

It is a sintaxe problem?

Tks

randywallace commented 8 years ago

You guys might want to try this fork: https://github.com/CheggEng/zabbix-cloudwatch

We stopped using Zabbix (in favor of Sensu) a couple years ago; as such, this has fallen into disrepair. Forgive me, but I don't have the time to look into this right now :(

randywallace commented 8 years ago

Ah, I see, -d is the Dimension Name from Cloudwatch, which in this case would be 'InstanceId'; then you would need a value for that Dimension Name, -v <instance_id>. Try that, and see if it works.

randywallace commented 8 years ago

/usr/local/bin/zabbix-cloudwatch -n AWS/EC2 -m CPUUtilization -d InstanceId -v i-d336b210 --aws-access-key MY_ACCESS --aws-secret-key MY_SECRET --aws-region us-west-1

fatgit commented 8 years ago

thanks for answer, but I get the errror /usr/local/share/gems/gems/getopt-1.4.3/lib/getopt/long.rb:152:in block in getopts': invalid switch 'i-d336b210' (Getopt::Long::Error) from /usr/local/share/gems/gems/getopt-1.4.3/lib/getopt/long.rb:91:ineach' from /usr/local/share/gems/gems/getopt-1.4.3/lib/getopt/long.rb:91:in each_with_index' from /usr/local/share/gems/gems/getopt-1.4.3/lib/getopt/long.rb:91:ingetopts' from /usr/local/share/gems/gems/zabbix-cloudwatch-0.2.0/bin/zabbix-cloudwatch:16:in <top (required)>' from /usr/local/bin/zabbix-cloudwatch:23:inload' from /usr/local/bin/zabbix-cloudwatch:23:in `

'

Ok. I will try the fork