wawastein / zabbix-cloudwatch

Cloudwatch integration for Zabbix 3.x
GNU General Public License v3.0
33 stars 53 forks source link

How to do Steps 8? #3

Closed khoi-thinh closed 5 years ago

khoi-thinh commented 7 years ago

Hi, Can you elaborate how to enable rules/items/trigger? In your guide, i also didn't see any thing about "executing external script". Not sure if i have to do that or not. Right now after creating new host, linked cloudwatch template, setup MACRO. I didn't see any items. In my case, i just want to see graph of all ELB's metric for a specific ELB (i have 3 ELB running). How can i do that?

wawastein commented 7 years ago

@khoi-thinh please navigate to "Discovery rules" tab in your host and make screenshot. Do you have any problems with other services (EC2, EDS etc) or you just need ELBs?

khoi-thinh commented 7 years ago

@wawastein Here's the screenshot chanvai

Let me tell you about what i want to do. I have 3 ELB running in singapore region. Let call them A,B,C. Now i want to get all metrics (HealthyHostCount, RequestCount, etc) from B and put them into zabbix and see the graph. That's it. I guess that we have to execute aws_discovery and cloudwatch.metric script and create a cron to execute them regularly??? I noticed that in your repo, there are 2 folders scripts: contain aws_discovery.py and cloudwatch.metric externalscripts: contain aws_discovery and cloudwatch.metric What's the script i need to execute?

In short, with my information like this ap-northeast-1a, the ELB named B, my account number is 2XX0-6XX0-XX52. How can i get full metrics from that ELB and make it the graph to see?

wawastein commented 7 years ago

@khoi-thinh I see, did you read my blog post about how this code works? Please read it first, there are answers to your questions: https://awawastuff.wordpress.com/2017/04/13/zabbix-and-cloudwatch-integration/. Also I'd recommend to get more familiar with Zabbix discovery feature if you want to understand how all of this works.

In short: you don't need any cron, zabbix handles it itself. Zabbix first runs aws_discovery.py script to get list of ELBs in your account, and then creates items based on template, which are being queried by cloudwatch.metric script. You need to setup account info for scripts to work properly.

Please follow blog post and let me know if you have additional questions.

vadim-kravchenko commented 6 years ago

Hi Alex. I have the same problem. So I try run in my shell:

./cloudwatch.metric --interval 600 --metric CPUCreditBalance --namespace AWS/EC2 --region eu-west-1 --dimension InstanceId=i-0d92fbf1111d022eb --statistic Maximum --account 012345678901

And shell told me:

Traceback (most recent call last): File "./cloudwatch.metric", line 85, in checker = Checker(config, args.account, "cloudwatch", args.region) File "/usr/lib/zabbix/scripts/discovery/aws_client.py", line 9, in init aws_key = config.get(account, "key") File "/usr/lib64/python2.7/ConfigParser.py", line 607, in get raise NoSectionError(section) ConfigParser.NoSectionError: No section: '012345678901'

I already configured "aws configure" and "aws.conf" file with actual credential, and I tried replace account number to Access Key but have same error message. Please, help me on this question.

wawastein commented 6 years ago

@vadim-kravchenko this script doesn't use your aws.conf that you configure via aws configure, it's separate file in /usr/lib/zabbix/scripts/conf/aws.conf, which has to look like this in your case:

[012345678901]
key = <your key>
secret = <your secret>

You don't need to name it 012345678901, you can use any name you find convenient, just make sure you pass same name as --account parameter.

vadim-kravchenko commented 6 years ago

@wawastein oh I didn't notice this, thanks a lot, it works.