Zabbix là một giải pháp giám sát mạng phân tán, là phần mềm sử dụng các tham số của một mạng, tình trạng và tính toàn vẹn của Server cũng như các thiết bị mạng.
Zabbix được sáng lập bởi Alexei Vladishev và hiện nay đang được phát triển và hỗ trợ bởi Zabbix SIA
Phần mềm Zabbix có thể theo dõi các thông số của mạng và tình trạng của server. Zabbix sử dụng các phương pháp cảnh báo linh hoạt, cho phép bạn cấu hình cảnh báo dựa trên email hoặc SMS cho hầu hết các sự kiện xảy ra, nắm bắt nhanh các sự cố xảy ra của server.
Bài viết mình chia sẻ các bạn xây dựng hệ thống giám sát Zabbix 6.0 trên Ubuntu 22.04LTS
Các bước cài đặt
Cài đặt Zabbix server, frontend, và agent
Zabbix 6.0 LTS version (supported until February, 2027)
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
Zabbix 6.4 standard version (supported until November, 2023)
wget https://repo.zabbix.com/zabbix/6.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu$(lsb_release -rs)_all.deb
sudo dpkg -i zabbix-release_6.4-1+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
Cấu hình database
Ở đây mình dùng mật khẩu rootDBpass làm mật khẩu gốc và zabbixDBpass làm mật khẩu Zabbix cho DB. Bạn nên thay đổi mật khẩu mới cho an toàn bảo mật.
Đầu tiên các bạn cài MariaDB 10.6
sudo apt install software-properties-common -y
curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
sudo bash mariadb_repo_setup --mariadb-server-version=10.6
sudo apt update
sudo apt -y install mariadb-common mariadb-server-10.6 mariadb-client-10.6
sudo systemctl start mariadb
sudo systemctl enable mariadb
Đổi mật khẩu root database
sudo mysql_secure_installation
Enter current password for root (enter for none):
Press Enter Switch to unix_socket authentication [Y/n]y
Change the root password? [Y/n]y
New password:<Enter root DB password>
Re-enter new password:<Repeat root DB password>
Remove anonymous users? [Y/n]:Y
Disallow root login remotely? [Y/n]:Y
Remove test database and access to it? [Y/n]:Y
Reload privilege tables now? [Y/n]:Y
Tạo database
sudo mysql -uroot -p'rootDBpass' -e "create database zabbix character set utf8mb4 collate utf8mb4_bin;"
sudo mysql -uroot -p'rootDBpass' -e "create user 'zabbix'@'localhost' identified by 'zabbixDBpass';"
sudo mysql -uroot -p'rootDBpass' -e "grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbixDBpass';"
Import schema và data
sudo zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p'zabbixDBpass' zabbix
Đổi database password trong Zabbix cấu hình file
sudo nano /etc/zabbix/zabbix_server.conf
DBPassword=zabbixDBpass
Cấu hình firewall
ufw allow 10050/tcp
ufw allow 10051/tcp
ufw allow 80/tcp
ufw reload
Start Zabbix server và agent processes
sudo systemctl restart zabbix-server zabbix-agent
sudo systemctl enable zabbix-server zabbix-agent
Cấu hình Zabbix frontend
sudo nano /etc/zabbix/apache.conf
Đổi time zone # php_value date.timezone Europe/Riga
php_value date.timezone Asia/Ho_Chi_Minh
Khởi động lại apache
sudo systemctl restart apache2
sudo systemctl enable apache2
Tiếp theo truy cập vào Zabbix http://server_ip_or_dns_name/zabbix và thiết lập ban đầu
Sau khi hoàn tất các bước cài đặt ở trên các bạn login vào Zabbix với username “Admin” và password “zabbix”. Bắt đầu add host và giám sát
Thêm host
Chúc các bạn thành công!