Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended host name field support #20

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

syquus
Copy link

@syquus syquus commented Aug 23, 2017

Added support for Collecting metrics of EC2 hosts without the limitation of having i-012345678 in HOST.HOST

In all our infrastructures, HOST indicates the hostname of the servers, not a particular field such as the "AWS instance id". Adapt existing infrastructures to this limitation doesn't make sense. The suggested PR consists on an OPTIONAL argument -H that indicates the value of HOST.HOST. If it exists, the zabbix_send method will send collected metrics to THAT HOST, no to IDENTITY (i-0123456789...)


Change Proposition for the Wiki:


This is Amazon CloudWatch metrics monitoring templates.

Requirements

Operation has been confirmed under the following environments.

  • CentOS7.2 or Amazon Linux 2016.3
  • Python 2.7
  • boto3(AWS SDK for Python)
  • Zabbix 2.2 or 3.0

Architecture

CloudWatch monitoring architecture

How to use

Only 3 steps.

  1. Download and set a python script
  2. Import template
  3. Register hosts

Download and set a python script

Please download scripts/cloudwatch_zabbix.py on your Zabbix Server (External Scripts directory).
And please set exec permission to Zabbix Server user(default: zabbix).

Import template

Please import templates/3.0/cloudwatch_template.xml at Zabbix WebGUI ([Configuration]->[Templates]->Import).
(In case of Zabbix 2.2: templates/2.2/cloudwatch_template.xml)

If you want to monitor the billing data, please import awsbilling_template.xml.

Register hosts

Please register Zabbix hosts for EC2 instances, RDS instances, ELB, EBS volume or others.

In case of an EC2 instance:

  • Host name: i-xxxxx (please set Instance ID) OR the desired Zabbix host name (please use arguments -i {$INSTANCE_ID} and -H {HOST.HOST} in this case)
  • Templates: Template AWS EC2
  • Macros:
    • {$REGION} : set AWS region name(e.g. ap-northeast-1)
    • {$KEY} : set AWS Access Key ID (e.g. AKI........)
    • {$SECRET} : set AWS Secret Access Key
    • {$INSTANCE_ID} : (optional) set Instance ID if HOST.HOST doesn't include it. (e.g. i-1234567890abcdef0)

In case of Billing data:

  • Host name: any
  • Templates: Template AWS Billing
  • Macros:
    • {$REGION} : set AWS region name to us-east-1
    • {$KEY} : set AWS Access Key ID
    • {$SECRET} : set AWS Secret Access Key

Tip

If you don't want to set AWS credentials info at Zabbix Macro, please set OS environment variables.

  • AWS_DEFAULT_REGION
  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY

And, please change external check items key.

before:

cloudwatch_zabbix.py[ec2,"-r",{$REGION},"-a",{$KEY},"-s",{$SECRET},"-i",{$INSTANCE_ID},"-H",{HOST.HOST},"-m","True"]

after:

cloudwatch_zabbix.py[ec2,"-i",{HOST.HOST},"-m","True"]

Julio Fernández Velasco and others added 3 commits August 23, 2017 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant