Why is it unique?
Zabbix agent automatically connects to cloudwatch and discovers AWS services (EC, EC2, RDS, ASG, DynamoDB) and starts monitoring "out of the box". It's not perfect, templates require some tuning and adjustments.
Services:
- DB
- Zabbix server
- Zabbix web interface
- Zabbix agent with scripts, based on original zabbix/zabbix-agent alpine image
Docker-compose file use 4 images:
- mysql:5.7
- zabbix/zabbix-server-mysql:latest
- zabbix/zabbix-web-nginx-mysql:latest
- aliaskov/aws-zabbix-agent:latest
Ports:
- 3306/tcp for DB conections
- 10051/tcp Zabbix checks
- 8080/tcp For Web Interface
Mounts:
- DB data files mysql_data/ on host are mounted on container's /var/lib/mysql
- Custom py scripts from agent_scripts/ are mounted on container's /etc/zabbix/zabbix_scripts
- Config files for scripts from agent_conf/ are mounted on container's /etc/zabbix/zabbix_agentd.d
AWS permissions (CloudFormation template creates and assigns role with listed policies to EC2 instance, where this stack runs):
- Cloudwatch readonly
- EC2 readonly
- RDS readonly (if RDS monitoring is needed)
- DynamoDB readonly (if DynamoDB monitoring is needed)
- AmazonElastiCacheReadOnlyAccess (if AmazonElastiCache monitoring is needed)
Usage
-
Try using CloudFormation template to launch EC2, attach EBS and create Zabbix role: AWS - CloudFormation - Create Stack - Upload a template to Amazon S3 - aws-cfn-ec2-zabbix-template.json
-
CloudFormation template adds userdata in order to pull docker compose file to start stack. Check /var/log/user-data.log, fix possible issues and start stack manually if needed: docker-compose -f zabbix-docker-compose.yml up -d
-
Import xml files (from templates dir) to zabbix web frontend, using web interface : Configuration - Templates - Import
Don't forget to delete all existing templates, and disconnect zabbix server from default linux PASSIVE template.
Enable zabbix server host and wait for aws services discovery zabbix - is automatically discovered host, which is a docker container with zabbix agent. Zabbix server - is a default entry. Make sure that AWS Services template is applied on it
Alternative way of importing templates: Modify DB/data.sql which contains default items,triggers, etc. and it is a part of zabbix/zabbix-server-mysql container (/usr/share/doc/zabbix-server-mysql/data.sql) and build your own zabbix-server-mysql image. Almost empty DBdump is in DB/MyzabbixDump.sql
One more way or importing templates: https://www.zabbix.com/documentation/3.2/manual/api