Open source integrated monitoring software "Zabbix"
Zabbix is an open source integrated monitoring software for centralized monitoring of servers, networks and applications. It provides monitoring, fault detection and notification functions required for integrated monitoring. With Zabbix agent and SNMP support for many platforms, you can monitor your entire system with a single Zabbix.
To run Zabbix, you will need the PHP programming language, MySQL as a database server, and a web server such as Apache or Nginx. In this article, we will assume that all of these have already been configured.
SELinux must be set to permissive
1 2 3 4 5 6 7 |
# setenforce 0 && sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config # cat /etc/selinux/config | grep SELINUX= # SELINUX= can take one of these three values: # NOTE: In earlier Fedora kernel builds, SELINUX=disabled would also #SELINUX=enforcing SELINUX=permissive |
1.Configure Zabbix repository
Install Repository
1 |
# rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/9/x86_64/zabbix-release-6.0-3.el9.noarch.rpm |
2. Installing Zabbix Server
Install Zabbix Server and other necessary Zabbix packages
1 2 3 |
# dnf install zabbix-server-mysql zabbix-web-mysql -y # dnf install zabbix-server-mysql zabbix-sql-scripts zabbix-selinux-policy -y # dnf install zabbix-agent -y |
3. Create Zabbix database and user
Create database schema for Zabbix server.
Create a MySQL database (e.g. my_zabbix_db), a user (e.g. zabbix_user) and a password (e.g. ?Wabcd123).
1 2 3 4 5 6 7 |
# mysql -u root -p Password: > CREATE DATABASE my_zabbix_db character set utf8 collate utf8_bin; >CREATE USER 'zabbix_user'@'localhost' IDENTIFIED BY '?Wabcd123'; >grant all on my_zabbix_db.* TO 'zabbix_user'@'localhost'; >FLUSH PRIVILEGES; >exit; |
4. Update Zabbix configuration
Edit Zabbix server configuration file /etc/zabbix_server.conf and update database configuration for Zabbix server to connect to database
1 2 3 4 5 6 7 8 9 |
# vi /etc/zabbix_server.conf Line 89 : Uncomment DBHost=localhost Line 101 : Change DBName=my_zabbix_db Line 117 : Change DBUser=zabbix_user Line 125 : Uncommented and added DBPassword='zabbix_user password' |
5. Import of Zabbix default database and initial data
Import the initial Zabbix database schema and data into the newly created database.
1 |
# zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql -uzabbix_user -p'?Wabcd123' my_zabbix_db |
You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
If you get the above error, set the log_bin_trust_function_creators variable as follows
1 |
mysql> SET GLOBAL log_bin_trust_function_creators = 1; |
6. Monitor Zabbix server itself
1 2 3 |
# vi /etc/zabbix_agentd.conf Line 180 : Change Hostname=[host name] |
Restart Zabbix Server and Agent Deamon so that they are ready to run at system startup.
1 2 |
# systemctl enable zabbix-server-mysql zabbix-agent httpd php-fpm # systemctl restart zabbix-server-mysql zabbix-agent httpd php-fpm |
7. Configure Zabbix firewall
Zabbix ports 10050 (on Zabbix server side) and 10051 (on zabbix agent side) must be allowed.
1 2 |
# firewall-cmd --add-port={10050,10051,80,443}/tcp --permanent # firewall-cmd --reload |
8. Running Zabbix Web Installer
Zabbix Web Installer can be accessed via "server IP/zabbix" or "domain/zabbix".
Open a web browser and enter "http: //[your-server-IP_Address]/zabbix".
You will get to the next screen. Click [Next step].
After confirming that all requirements are OK, click [ Next step]
Enter the information you have set in the "Database name", "User", and "Password" fields, and click [ Next step ].
Enter any name for "Zabbix server names" and select Asia/Tokyo for time zone.
After confirming that you are in your own time zone, click [ Next step ].
Reconfirm settings If information is correct, click [Next step]
When the installation is successfully completed, the following page will appear. Click [Finish]
You will be redirected to Zabbix login page
Log in using the following credentials
Username:Admin
Password:zabbix
After successful login you will see the following screen (Zabbix Dashboard).
9. Various settings of Zabbix
9.1 Administrator password change, administrator email address settings
Change Admin Password
Also, set up the administrator's email address.
①Select "Administration" - "Users" in the left pane and click "Admin" in the right pane
②Click [Change paddword]
③Enter the password you wish to change and click Update]
④Come back to the [Users] screen, go to the [Media] tab, and click the [Add] link
Select "Email" in the "Type" field, enter the administrator's email address in the "Send to" field, and click the "Add" button.
⑥Click the "Update" button to complete registration.
9.2 Monitoring Host Configuration
①Log in to the Zabbix administration site and select [Configuration] - [Hosts] in the left pane.
In the right pane, you should see the local hosts with Zabbix Agent installed, check them and click the "Enable" button.(Currently I think it shows the zabbix server itself)
②[Status] will change to [Enabled] and the system will be monitored. Since the template for Linux is set by default, this is all that is needed to monitor major items such as CPU usage.
③Host name is registered with Zabbix server by default, but this should match with [Hostname=***] set in /etc/zabbix_agentd.conf.
Click on [Zabbix server]
Change [Host name] and click [update]
④After some time has passed, various data will be collected and the status of the server can be checked as shown below.
Left side Monitoring > Hosts Click
④Click on Lepard Select [Grahs]
The following monitoring status screen will appear