Contents
Installation of 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/MariaDB as a database server, and a web server such as Apache or Nginx.
In this case, we will assume that all of the following conditions have already been configured.
Install Zabbix 6.x server, frontend and agent
①Install repository
Setup Zabbix 6.x repository and install Zabbix Server.
Install Zabbix Agent for the monitored hosts so that Zabbix Server itself can be monitored at the same time.
1 |
# wget https://repo.zabbix.com/zabbix/6.5/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.5-1%2Bubuntu22.04_all.deb |
1 |
# dpkg -i zabbix-release_6.5-1+ubuntu22.04_all.deb |
1 |
# apt update |
1 |
# apt -y install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent2 php-mysql php-gd php-bcmath php-net-socket |
Create database and user for Zabbix
Create database schema for Zabbix server.
Login to MySQL server as root and create MySQL database (e.g. my_zabbix_db), user (e.g. zabbix_user) and password (e.g.?WWabcd123)
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 '?WWabcd123'; >GRANT ALL PRIVILEGES ON my_zabbix_db.* TO 'zabbix_user'@'localhost' WITH GRANT OPTION; >FLUSH PRIVILEGES; >exit; |
Load Zabbix default schema for database
1 |
# zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix_user -p'?WWabcd123' my_zabbix_db |
Update Zabbix configuration
Edit Zabbix server configuration file /etc/zabbix/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/zabbix_server.conf Line 95 # delete, uncomment and change DBHost=127.0.0.1 Line 107 change DBName=my_zabbix_db Line 123 change DBUser=zabbix_user Line 131 uncommented and added DBPassword='zabbix_userのpassword' |
Monitor Zabbix server itself
1 2 3 4 5 6 7 |
# vi /etc/zabbix/zabbix_agent2.conf # Line 80 : Specify Zabbix server Server=127.0.0.1 # Line 132 : Specify Zabbix server ServerActive=127.0.0.1 # Line 144 : Change to own hostname Hostname=Lepard |
Restart Zabbix Server and Agent Deamon so that they are ready to run at system startup.
1 2 |
# systemctl enable zabbix-server zabbix-agent2 apache2 # systemctl restart zabbix-server zabbix-agent2 apache2 |
PHP Configuration
1 2 3 4 5 6 7 8 9 10 |
# vi /etc/php/8.1/fpm/pool.d/www.conf # Add to the last line php_value[max_execution_time] = 300 php_value[memory_limit] = 128M php_value[post_max_size] = 16M php_value[upload_max_filesize] = 2M php_value[max_input_time] = 300 php_value[max_input_vars] = 10000 php_value[always_populate_raw_post_data] = -1 php_value[date.timezone] = Asia/Tokyo |
Configuration Reflection
1 |
# systemctl restart apache2 php8.1-fpm |
Configure Zabbix firewall
Allow Zabbix ports 10050 (Zabbix server side) and 10051 (zabbix agent side)
1 2 3 4 5 |
# ufw allow 10050:10051/tcp # ufw allow http # ufw allow https # ufw reload |
Running Zabbix Web Installer
Zabbix Web Installer can be accessed via "your-server-ip/zabbix" or "domain/zabbix".
Open a web browser and enter "http: //[your-server-IP_Address]/zabbix".
You will get the following screen. [ Next step]. For some reason Zabbix 7.0 will start up, but I don't know why.
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.
Make sure that you are in your own timezone and 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 default credentials
Username: Admin
Password: zabbix
After successful login you will see the following screen (Zabbix Dashboard).
Various settings of Zabbix
Change Admin Password
Change the default administrator password for security purposes
①Select [Users] - [Users] in the left pane and click [Admin] in the right pane
②[Change paddword] click
③Current password : Enter default password zabbix
Enter the password you wish to change and click Update.
The following will be displayed and when you click "OK", you will be taken to the login authentication screen again, so log in with the changed password.
Monitoring Host Configuration
①Log in to Zabbix administration site and select Data collection - Hosts in the left pane. In the right pane you should see local hosts with Zabbix Agent installed, check them and click on the Enable button. (Currently only the zabbix server itself should be shown).
②[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 will be registered as Zabbix server by default, but it should match [Hostname=***] set in /etc/zabbix/zabbix_agent2.conf. Click on [Zabbix server], make changes and click on [Update] button.
Host nameがLepardに変わっています
④
After some time has passed, various data will be collected and the status of the server can be checked as follows.
On the left side, click Monitoring > Hosts
Click Lepard Select [Grahs]
The following monitoring status screen will appear
Add monitored hosts
Add the following servers to the list
OS : Debian12
IP address : 192.168.11.100
1.Configuration on the server you want to monitor
1.1 Install Zabbix Agent on the server you want to monitor
1 |
# wget https://repo.zabbix.com/zabbix/6.5/debian/pool/main/z/zabbix-release/zabbix-release_6.5-1%2Bdebian12_all.deb |
1 |
# dpkg -I zabbix-release_6.5-1+debian12_all.deb |
1 |
# apt update |
1 |
# apt -y install zabbix-agent2 |
1.2.Edit zabbix-agent configuration file
1 2 3 4 5 6 7 8 |
# vi /etc/zabbix/zabbix_agent2.conf # Line 78 : Specify Zabbix server (in this case 192.168.11.83) Server=192.168.11.83 # Line 131 : Specify Zabbix server (in this case 192.168.11.83) ServerActive=192.168.11.83 # Line 142 : Change to your hostname (debian this time) Hostname=debian |
1 |
# systemctl restart zabbix-agent2 |
1.3 Configure firewall on Zabbix-agent side
Allow Zabbix ports 10050 (Zabbix server side) and 10051 (zabbix agent side)
1 2 |
# ufw allow 10050:10051/tcp # ufw reload |
2. Configuration in Zabbix WEB UI
Log in to the Zabbix administration site, select [Datacollection] - [Hosts] in the left pane and click the [Create Host] button at the top of the right pane.
Enter a hostname in the [Hostname] field.
Click the [Select] button to the right of the [Templates] item.
Click [Select]
Select [Templates/Operating systems]
Select [Linux by Zabbix agent active]
Under [Host groups] click [Select].
Select [Linux servers]
Under [Interfaces], click [Add] [Agent]
Enter the [IP address] and [DNS name] of the monitored server and click [Update].
New monitored servers are registered.