Zabbix installation on Amazon EC2

Reading Time: 4 minutes

Zabbix is an enterprise-class open-source distributed monitoring tool.
It helps in network monitoring, server monitoring, Cloud monitoring, and many more.
Around 200+ integration supported. It can collect metrics from multiple sources, detect problems instantly, get alerts, and help in data visualization.

More information can be checked on the introduction blog

Installation

Install Zabbix server, Frontend, and Database

Steps for installing the Zabbix server, Frontend, and Database on the AWS EC2

Prerequisite

Memory
Zabbix requires both physical and disk memory. The disk memory needed depends on the number of hosts (monitoring targets) and parameters.

The more physical memory you have, the faster the database (and therefore Zabbix) works.

CPU
The database may require CPU depending on the parameters and database engine.

Supported Platform
Unix is the only OS that can deliver the maximum performance but it also runs on different OS for different components
Zabbix Server – Linux, IBM AIX, FreeBSD, NetBSD, OpenBSD, HP-UX, Mac OS X, Solaris
Agent – Linux, IBM AIX, FreeBSD, NetBSD, OpenBSD, HP-UX, Mac OS X, Solaris, Windows
Agent 2 – Linux, Windows

Note: Zabbix server/agent may work on other Unix-like operating systems as well. Zabbix agent is supported on all Windows desktop and server versions since XP.

Required Software

Database
MySQL
PostgreSQL

There are other requirements, you can find them here

For this example, we have an Amazon EC2
– Instance type t2.large
– Ubuntu 22.04 (Jammy)
– MySQL server and apache web server installed
– Zabbix 6.4 server is installed on the above EC2 using the packages there are other ways to install it can be checked here

Download the Zabbix from here

Step 1: Open the Zabbix Download page

Zabbix Download page

Step 2: Choose your platform and select the necessary details

Choose the Platform and other information for the Zabbix download
Choose the Platform and other information for the Zabbix download

Step 3: Install and configure Zabbix

wget https://repo.zabbix.com/zabbix/6.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.2-4%2Bubuntu22.04_all.deb
Download the Zabbix deb package
dpkg -i zabbix-release_6.2-4+ubuntu22.04_all.deb
Installing Zabbix Deb package

apt update

apt update before zabbix installation

Installing Zabbix server, frontend, and agent also the SQL scripts for initial database setup

apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent
apt install zabbix server, frontend and initial database script
apt install zabbix server, frontend and initial database script
mysql -uroot -p
password to be entered when promoted: password
mysql zabbix database installation

Run the following commands on the MySQL prompt

mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
create database in mysql for zabbix
mysql> create user zabbix@localhost identified by 'password';
create user in mysql for zabbix
mysql> grant all privileges on zabbix.* to zabbix@localhost;
grant all privilages in mysql for zabbix
mysql> set global log_bin_trust_function_creators = 1;
enabling log_bin_trust-function_creators in mysql
mysql> quit;
quit mysql

Import the initial schemas and data in the database using the script

zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix

This will also ask for the password. The password in this case is password as given in the create user command of MySQL create user zabbix@localhost identified by 'password'

install the sql script

now, disable the log_bin_trust-function_creators option in MySQL
Open MySQL prompt

mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;

disabling  log_bin_trust_function_creators option

To Configure the database for Zabbix Server. edit the /etc/zabbix/zabbix_server.conf file

DBPassword=password

password is used in create user command before

Start Zabbix server and agent processes

systemctl restart zabbix-server zabbix-agent apache2
systemctl enable zabbix-server zabbix-agent apache2
start and enable zabbix server, agent and apache server

Configure the Zabbix Server

Open the web browser and enter the public IP address of the ec2 in which the Zabbix server is installed with /zabbix after the IP address

Configuring zabbix on the ec2

Check for pre-requisites

check for pre-requisties


Configure DB Connection

configuring DB connection


Settings

setting for the zabbix user


Pre-Installation Summary

Pre-installation summary

Successfully configured Zabbix

Note: The default username and password for zabbix are admin/Zabiix

Zabbix home

References

Written by 

Shivam Gupta is a Software Consultant at Knoldus Software LLP. He has done MCA from Bharati Vidyapeeth Institute of Computer Application and Management, Paschim Vihar. He has a keen interest toward learning new technologies. He has a decent knowledge of Java Language. His practice area is DevOps. When he is not working, you will find him watching anime or with a book.