Zabbix is a powerful, open-source monitoring solution that provides real-time insights into the health and performance of your IT infrastructure. This guide will walk you through a complete Zabbix installation and configuration process on both CentOS and Ubuntu servers, empowering you to gain comprehensive control over your network, servers, and cloud services.
Server Environment: A CentOS 7/8 or Ubuntu 20.04/22.04 server ready to host your Zabbix installation. This server should have a dedicated user with sudo privileges for administrative tasks.Memory Capacity: Allocate at least 2 GB of RAM for the Zabbix server to ensure smooth operation and efficient monitoring.Unique Identification: Assign a fully qualified domain name (FQDN) or a static IP address to your Zabbix server for seamless communication.Database Foundation: A pre-installed and configured MySQL or MariaDB database server to store Zabbix data and configurations.
sudo yum update
sudo yum install httpd
# For CentOS 7
sudo rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/7/x86_64/zabbix-release-6.0-1.el7.noarch.rpm
# For CentOS 8
sudo rpm -Uvh https://repo.zabbix.com/zabbix/7.0/centos/8/x86_64/zabbix-release-7.0-5.el8.noarch.rpm
sudo yum update
sudo dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
sudo yum install mariadb-server
sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo mysql_secure_installation
mysql -u root -p
CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';
set global log_bin_trust_function_creators = 1;
FLUSH PRIVILEGES;
EXIT;
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql - default-character-set=utf8mb4 -uzabbix -p Zabbix
mysql -u root -p
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;
sudo nano /etc/zabbix/zabbix_server.conf
DBName=Zabbix # Database name
DBUser=Zabbix # Database user
DBPassword=your_password # Database password
sudo systemctl start zabbix-server zabbix-agent httpd
sudo systemctl enable zabbix-server zabbix-agent httpd
sudo firewall-cmd -permanent - add-service=http
sudo firewall-cmd - reload
sudo firewall-cmd - permanent - add-port=10050/tcp
sudo firewall-cmd - permanent - add-port=10051/tcp
sudo firewall-cmd - reload
http://your_server_ip_or_domain/zabbix
Username: Admin
Password: zabbix
sudo apt update
sudo apt install apache2
# For Ubuntu 20.04
wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-1%2Bubuntu20.04_all.deb
sudo dpkg -i zabbix-release_6.0–1+ubuntu20.04_all.deb
# For Ubuntu 22.04
wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.0-2+ubuntu22.04_all.deb
dpkg -i zabbix-release_7.0-2+ubuntu22.04_all.deb
sudo apt update
sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent
sudo apt install mariadb-server
sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo mysql_secure_installation
mysql -u root -p
CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';
set global log_bin_trust_function_creators = 1;
FLUSH PRIVILEGES;
EXIT;
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql - default-character-set=utf8mb4 -uzabbix -p zabbix
mysql -u root -p
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;
sudo nano /etc/zabbix/zabbix_server.conf
DBName=zabbix # Database name
DBUser=zabbix # Database user
DBPassword=your_password # Database password
sudo systemctl start zabbix-server zabbix-agent apache2
sudo systemctl enable zabbix-server zabbix-agent apache2
sudo ufw allow 80/tcp
sudo ufw allow 10050/tcp
sudo ufw allow 10051/tcp
sudo ufw enable
http://your_server_ip_or_domain/zabbix
Username: Admin
Password: zabbix
http://your_server_ip_or_domain/zabbix
Navigate to: Monitoring > Hosts Click on Create host. Enter Host Details: Host name: A unique name for the host (e.g., WebServer01).Visible name: (Optional) A user-friendly name to display in the Zabbix UI.Groups: Select or create a group to categorize your hosts (e.g., Linux Servers).Interfaces: Add an interface (e.g., Agent, SNMP) with the IP address or DNS name of the host.
Assign Templates for Automated Monitoring: In the Templates tab, click on Select. Choose a template matching the host type (e.g., Template OS Linux for a Linux server). Click Add to assign the template to the host.
Click Add to save the host configuration.
Navigate to: Monitoring > Latest data Select the host from the list and review the collected metrics to confirm successful monitoring.
Navigate to: Administration > User groups Click on Create user group. Enter Group Details: Name: A descriptive name for the group (e.g., IT Support).Permissions: Set the permission level for each host group (e.g., read-only or read-write).
Click Add to save the user group.
Navigate to: Users Click on Create user. Enter User Details: Alias: The username for login.Groups: Select the user group created earlier (e.g., IT Support).Password: Set a password for the user.
Set User Permissions: In the Permissions tab, specify which host groups the user can access and their level of access.
Click Add to create the user.
Navigate to: Alerts > Media types Click on Email to configure email settings. Enter SMTP Settings: Email Provider: Select your email provider (e.g., Gmail, Outlook).SMTP email: The sender's email address (e.g.,zabbix@example.com ).
Click Update to save the settings.
Navigate to: Alerts > Actions Click on Create action. Enter Action Details: Name: A descriptive name for the action (e.g., High CPU Usage Alert).Conditions: Define conditions that trigger the action (e.g., Trigger severity = High).
Add an Operation: In the Operations tab, click on Add. Choose Send message as the operation type. Select the user group and the media type (e.g., email).
Click Add to save the action.
Navigate to: Dashboards Click on Create dashboard. Enter Dashboard Details: Name: A descriptive name for the dashboard (e.g., Network Overview).
Add Widgets: Click on Add widget to add various widgets, such as graphs, maps, or problems. Configure each widget according to your needs.
Click Save changes to save the dashboard.
After adding widgets, you can rearrange the dashboard layout by dragging and dropping them. Customize each widget by clicking on the widget’s settings icon and adjusting the parameters (e.g., time period, display options).
Navigate to: Administration > Housekeeping Configure History and Trend Retention: Set how long historical data (e.g., raw data) is kept (e.g., 90 days). Set how long trends (e.g., daily averages) are kept (e.g., 365 days).
Click Update to save the housekeeping settings.
Create a backup of the Zabbix database: mysqldump -u zabbix -p zabbix > /backup/zabbix_backup.sql
Automate Backups: Schedule the backup script using cron to automate the backup process.
Restore the Zabbix database from a backup: mysql -u zabbix -p zabbix < /backup/zabbix_backup.sql
0 comments:
Post a Comment