📸Install Zabbix For EC2 Monitoring & How To Connect To Databases On Different Resources

Introduction

Zabbix Monitoring

Zabbix is ​​an open source software that can be used to monitor networks and the status of various types of devices, servers and other network hardware. This software was created by Alexei Vladishev. With Zabbix, users can easily find out server status, network conditions and get notifications if problems occur.

Amazon RDS

Amazon Relational Database Service (Amazon RDS) is a web service that makes it easy to set up, operate, and scale relational databases on the AWS Cloud Cloud. This service provides cost-effective, scalable capacity for industry-standard relational databases as well as managing general database administration tasks. Amazon RDS provides Amazon CloudWatch metrics for your database instances at no additional cost. You can use the Amazon RDS Console to view key operational metrics, including compute/memory/storage capacity utilization, I/O activity, and instance connections.

Zabbix NMS Architecture

  1. Zabbix Server : is the main process or main component of NMS Zabbix, this component contains the configuration of Zabbix and network services. Zabbix server uses port 10051.

  2. Zabbix Agent : is a UNIX daemon that runs on the host being monitored (monitoring), this agent collects information, monitors host performance, and sends this information to the Zabbix Server. Zabbix agent uses port 10050.

  3. Zabbix Proxy : Is a process whose task is to collect performance and availability results from one or more monitored devices and send the data to the Zabbix server.


Configuration AWS

Create a New EC2 Instance

Name : Server-Zabbix
Ubuntu 22.04 (t2.small)
keypair : vockey (pem)
Create new SG
"SG-All TCP Open"

Create Database RDS

MariaDB 10.6.10
DB Instance Identity : db-zabbix
Master-username : root
Master-password : rootDBpass
Free tier
db.t2.micro
SG VPC: (Choose exiting) default

endpoint RDS : db-zabbix.c52qu2eqwb8t.us-east-1.rds.amazonaws.com

Modify SecurityGroup "SG-default"

Edit Inbound rules SG-default

MySQL/Aurora | TCP | 3306 | Custom (SG-All TCP Open)

Create RDS Group Parameters

Parameter group family: mariadb10.6
Group name: parameter-zabbix
Description: permit zabbix server to replicated databases

Edit parameter-zabbix

log_bin_trust_function_creators : Value 1

Modify Database

Database option : parameter-zabbix
"apply immediately"

#Reboot Database#

Configuration EC2

Update Repository

sudo -i
apt update && apt upgrade -y

Install Package

wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-4+ubuntu$(lsb_release -rs)_all.deb
sudo dpkg -i zabbix-release_6.0-4+ubuntu$(lsb_release -rs)_all.deb
sudo apt update
sudo apt -y install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent
apt install mariadb-client

Connect to Database

sudo mysql -uroot -p'rootDBpass' -h <endpoint-rds>

Create a Database

create database zabbix character set utf8 collate utf8_bin;
create user 'zabbix'@'%' identified by 'zabbixDBpass';
grant all privileges on zabbix.* to 'zabbix'@'%' identified by 'zabbixDBpass';
exit;

Configuration Database

sudo zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql -f --default-character-set=utf8mb4 -uzabbix -p'zabbixDBpass' -h <endpoint-rds> zabbix

Database Verification

nano /etc/zabbix/zabbix_server.conf
DBHost=<endpoint-rds>
DBPassword=zabbixDBpass

Restart Firewall

ufw allow 10050/tcp
ufw allow 10051/tcp
ufw allow 80/tcp
ufw reload

if unable to reload firewall, enable firewall first

ufw enable
ufw reload

Restart Zabbix Service

systemctl restart zabbix-server zabbix-agent
systemctl enable zabbix-server zabbix-agent

Timezone configuration

nano /etc/zabbix/apache.conf
php_value date.timezone Asia/Jakarta

Configuration Zabbix

Setup Zabbix in Browser

<ip-addr-pub-ec2-zabbix-server/zabbix>

Database type : MySQL
Database host : <endpoint-rds>
Database name : zabbix
User : zabbix
Password : zabbixDBpass
Database TLS encryption : yes

Login to Zabbix Dashboard

User: Admin
Pass: zabbix

Last updated