Contents
Installation of open source integrated monitoring software "Zabbix7".
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.
This time we will install Zabbix 7.0 LTS released on 06/04/2024 in the following environment.
FreeBSD14.1 IP(192.168.11.83)
Apache/2.4.59 (FreeBSD)
mysql Ver 8.0.35
PHP 8.3.6 (cli)
PHP 8.3.6 (fpm-fcgi)
zabbix7-server , zabbix7-agent , zabbix7-frontend Install
➁Download and install Binary Package
The port collection does not have the Zabbix 7 package, so the
zabbix7-server
zabbix7-agent
zabbix7-frontend-php83
Download and install the Binary Package.
Install Zabbix Agent for the monitored hosts so that Zabbix Server itself can be monitored at the same time.
1 2 |
# wget https://pkg.freebsd.org/FreeBSD:14:amd64/latest/All/zabbix7-server-7.0.0.pkg # pkg install zabbix7-server-7.0.0.pkg |
1 2 |
# wget https://pkg.freebsd.org/FreeBSD:14:amd64/latest/All/zabbix7-frontend-php83-7.0.0.pkg # pkg install zabbix7-frontend-php83-7.0.0.pkg |
1 2 |
# wget https://pkg.freebsd.org/FreeBSD:14:amd64/latest/All/zabbix7-agent-7.0.0.pkg # pkg install zabbix7-agent-7.0.0.pkg |
Create database and user for Zabbix
①Adding settings to mysql my.cnf
Add to the [client] and [mysql] fields
1 2 3 4 5 6 |
[client] default-character-set = utf8mb4 [mysqld] skip-networking character-set-server = utf8mb4 |
➁Creation and initialization of database for zabbix
database my_zabbix_db
user zabbix_user
password ?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; >set global log_bin_trust_function_creators = 1; >exit; |
initialization
1 2 3 4 |
# cd /usr/local/share/zabbix7/server/database/mysql # mysql -uzabbix_user -p?WWabcd123 my_zabbix_db < schema.sql # mysql -uzabbix_user -p?WWabcd123 my_zabbix_db < images.sql # mysql -uzabbix_user -p?WWabcd123 my_zabbix_db < data.sql |
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 |
# vi /usr/local/etc/zabbix7/zabbix_server.conf Line 101 : Change DBName=my_zabbix_db Line 117 : Change DBUser=zabbix_user Line 125 : Uncommented and added DBPassword=?WWabcd123 |
Automatic startup setting
1 2 3 4 |
# vi /etc/rc.conf Add the following zabbix_server_enable="yes" |
Start up
1 |
# /usr/local/etc/rc.d/zabbix_server start |
Monitor Zabbix server itself
1 2 3 4 5 6 7 8 |
# vi /usr/local/etc/zabbix7/zabbix_agentd.conf # Line 113 : Specify Zabbix server Server=127.0.0.1 # Line 167 : Specify Zabbix server ServerActive=127.0.0.1 # Line 178 : Change to own hostname Hostname=Lepard |
Restart Zabbix Server and Agent Deamon so that they are ready to run at system startup.
1 2 3 4 |
# vi /etc/rc.conf Add the following zabbix_agentd_enable="YES" |
Start up
1 |
# /usr/local/etc/rc.d/zabbix_agentd start |
Configuring Zabbix Frontend
Web server Apache httpd configuration for Zabbix Frontend
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# vi /usr/local/etc/apache24/httpd.conf Add the following <FilesMatch "\.php$"> SetHandler application/x-httpd-php </FilesMatch> <FilesMatch "\.phps$"> SetHandler application/x-httpd-php-source </FilesMatch> <Directory "/usr/local/www/zabbix7"> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> DocumentRoot "/usr/local/www/zabbix7" DirectoryIndex index.html index.php |
PHP Configuration
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# cd /usr/local/etc/ # cp php.ini-production php.ini # vi /usr/local/etc/php.ini Line 419 max_execution_time = 300 Line 518 display_errors = Off Line 713 post_max_size = 16M Line 865 upload_max_filesize = 2M Line 989 : Uncommented and added "Asia/Tokyo" to the time zone setting. [Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone = "Asia/Tokyo" |
1 2 3 4 5 6 7 8 9 10 |
# vi /usr/local/etc/php-fpm.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 |
Apache restart
1 |
# /usr/local/etc/rc.d/apache24 restart |
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].
![](https://korodes.com/wp-content/uploads/2024/06/487905cae2c7e8e18dff3b2f08e1a79f.jpg)
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 ].
![](https://korodes.com/wp-content/uploads/2024/06/725b954727fcfdf58d39eb2a92a9f889.jpg)
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 ].
![](https://korodes.com/wp-content/uploads/2024/06/18f52fec5be8f6b2bfefc24d68d5c3b6.jpg)
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
![](https://korodes.com/wp-content/uploads/2024/06/2083fc461326e6cddc8bcaef6c2c458e.jpg)
After successful login you will see the following screen (Zabbix Dashboard).
![](https://korodes.com/wp-content/uploads/2024/06/f3836c26e0722b5b2c318220417c0daf.jpg)
Various settings of Zabbix
Change Admin Password
For security purposes, change the default administrator password
Once the above dashboard is displayed, continue
①Select [Users] - [Users] in the left pane and click [Admin] in the right pane
![](https://korodes.com/wp-content/uploads/2024/06/f2a37aad263c1b3a07c6835e9d75f839.jpg)
②Click [Change paddword]
③Current password : Enter default password zabbix
Enter the password you wish to change and click Update.
![](https://korodes.com/wp-content/uploads/2024/06/6b21198ebb4111a3e01438f3cabb6354.jpg)
You will be redirected to the login authentication screen again, so login with the password you created.
![](https://korodes.com/wp-content/uploads/2024/06/90e0a5a03450d3edc031da8ffebcd08f.jpg)
Email notification settings
Set up notifications so that you can receive various information, etc. by e-mail.
It is assumed that an SMTP server such as postfix is installed on the server.
①Select [Alerts] - [Media Types] in the left pane and click [Email] in the right pane
![](https://korodes.com/wp-content/uploads/2024/06/e8bba3ce337637dd598f4cc45ea926d7.jpg)
➁Configure the mail server settings as shown below, check the [Enabled] checkbox, and click the [Update] button.
![](https://korodes.com/wp-content/uploads/2024/06/87d2dc409c25495b90413bff386d0f40.jpg)
➂[Email] becomes [Enabled]
④Select [Users] - [Users] in the left pane and click [Admin] in the right pane
![](https://korodes.com/wp-content/uploads/2024/06/5e9e54f7ab4b02bfda58db5cbfee3a2d.jpg)
⑤Go to the "Media" tab and click [Add]
⑥Select "Email" for "Type," enter the administrator's email address in the "Send to" field, and click [Add]
⑦Click the [Update]button.
![](https://korodes.com/wp-content/uploads/2024/06/3cae997a06d3f263f5c1da7c42fa9a89.jpg)
⑧In the left pane, select [Alerts] - [Actions] - [Trigger actions]
⑨In the right pane, click on [Report problems to Zabbix administrators]
⑩Check [Enabled] and click [Update] button.
Various failure notifications are then sent to the email address you set.
![](https://korodes.com/wp-content/uploads/2024/06/4634afbb48a850779b527b0ab2855ad8.jpg)
Add monitored hosts
Added the following servers as targets
OS : openSUSE15.6
IP address : 192.168.11.200
Host name : Lion
1.Configuration on the server you want to monitor
1.1 Install Zabbix Agent on the server you want to monitor
1 2 |
# rpm -Uvh --nosignature https://repo.zabbix.com/zabbix/7.0/sles/15/x86_64/zabbix-release-7.0-1.sles15.noarch.rpm # zypper --gpg-auto-import-keys refresh 'Zabbix Official Repository' |
1 |
# zypper -n install zabbix-agent2 zabbix-agent2-plugin-* |
1.3 Edit zabbix-agent configuration file
1 2 3 4 5 6 7 8 |
# vi /etc/zabbix/zabbix_agent2.conf # Line 80 : Specify Zabbix server (in this case 192.168.11.83) Server=192.168.11.83 # Line 133 : Specify Zabbix server (in this case 192.168.11.83) ServerActive=192.168.11.83 # Line 144 : Change to your own host name (Lion in this case) Hostname=Lion |
1 2 |
# systemctl restart zabbix-agent2 # systemctl enable zabbix-agent2 |
1.4 Configure firewall on Zabbix-agent side
Zabbix ports 10050 (on Zabbix server side) and 10051 (on zabbix agent side) must be allowed.
1 2 3 |
# firewall-cmd --add-port=10050/tcp --permanent # firewall-cmd --add-port=10051/tcp --permanent # firewall-cmd --reload |
2. Configuration in Zabbix WEB UI
2.1 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.
![](https://korodes.com/wp-content/uploads/2024/06/5f7f7f330cebc6e96e5d63d41c0a4fc5.jpg)
2.2 Enter a hostname in the [Hostname] field (in this case, Lion).
For [Templates], click on the [Select] button and select [Linux by Zabbix agent] from the list of monitoring templates if you want to monitor common items such as CPU on Linux OS.
![](https://korodes.com/wp-content/uploads/2024/06/e2a7d89088673f20dce079305171d7c1.jpg)
2.3 Select [Linux servers] for [Host groups]
2.4 In [Interfaces], click [Add] under Interfaces, enter the IP address to be monitored, and then click [Add] at the bottom.
![](https://korodes.com/wp-content/uploads/2024/06/e3577bb8ad43380d96efa07128b45a69.jpg)
2.5 New monitored servers are registered.
![](https://korodes.com/wp-content/uploads/2024/06/aa6a746a7e6d028afc4229d218b16c90.jpg)
After a while, the data of the added target hosts will be displayed.
![](https://korodes.com/wp-content/uploads/2024/06/05a072b455af81588ece1637a9c30914.jpg)
![](https://korodes.com/wp-content/uploads/2024/06/c68669e22f022c779268a74fe883ed38.jpg)
![](https://korodes.com/wp-content/uploads/2024/06/d31f83d9ff85ef647bf89a42f3ba065f.jpg)
Add items to be monitored
This time we will add Apache httpd service on Zabbix server to be monitored
1. Enable server-status in Apache httpd on monitored Zabbix serverする
Edit apache configuration file httpd.conf
1 2 3 4 5 6 7 8 9 10 |
# vi /usr/local/etc/apache24/httpd.conf Line 161 : Check if status_module is enabled LoadModule status_module libexec/apache24/mod_status.so Add the following to the last line <Location /server-status> SetHandler server-status Require local </Location> |
1 |
# service apache24 restart |
2. Log in to Zabbix administration site, in the left pane click on [Data collection] - [Hosts], in the right pane click on the host you want to add monitoring items for (in this case Zabbix server)
![](https://korodes.com/wp-content/uploads/2024/06/4113a956786c0f1a1dc302409f672d5c.jpg)
3. Click the [Select] button in the [Templates] section
![](https://korodes.com/wp-content/uploads/2024/06/1a62b5c1c543859265c8961ba207e155.jpg)
4. Click the [Select] button.
![](https://korodes.com/wp-content/uploads/2024/06/88857fa14e5f4459c858f506d5be8dad.jpg)
5. Click on [Templates/Applications]
6. Select [Apache by Zabbix agent], then [Select]
7. Click [Update] button to update settings
![](https://korodes.com/wp-content/uploads/2024/06/3cfb132bf443b5afffc4e28129562f20.jpg)
8. Click the [Apache by Zabbix agent] link.
![](https://korodes.com/wp-content/uploads/2024/06/d6665565cac928f0eb5b4fd09212101d.jpg)
9. Open the [Macros] tab, enter [127.0.0.1] in {$APACHE.STATUS.HOST} and [Update]
After a while, data will be displayed as shown in the figure below.
![](https://korodes.com/wp-content/uploads/2024/06/d68814646a8b032a661042424aed9239.jpg)
![](https://korodes.com/wp-content/uploads/2024/06/485bdd155e22292e91e8778fd57f36a0.jpg)