Monitoring server-what is Zabbix
Zabbix is an enterprise-level open source distributed monitoring server solution. The software can monitor different parameters of the network and the integrity of the server, and also allows the configuration of email-based alerts for any event. Zabbix provides reports and [Data Visualization] (https://cloud.tencent.com/product/yuntu?from=10680) functions based on the data stored in the database (such as MySQL). Every measurement index collected by the software can be accessed through a web-based interface.
Zabbix is released under the terms of the GNU General Public License version 2 (GPLv2) and is completely free.
In this tutorial, we will install Zabbix on an Ubuntu 16.04 server running MySQL, Apache, and PHP.
Install Zabbix server
First, we need to install several PHP modules required by Zabbix:
# apt-get install php7.0-bcmath php7.0-xml php7.0-mbstring
The Zabbix package provided in the Ubuntu repository is outdated. Use the official Zabbix repository to install the latest stable version.
Install the warehouse package by executing the following command:
$ wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+xenial_all.deb
# dpkg -i zabbix-release_3.2-1+xenial_all.deb
Then update the apt
package source:
# apt-get update
Zabbix server with MySQL support and PHP front end can now be installed. Excuting an order:
# apt-get install zabbix-server-mysql zabbix-frontend-php
Install Zabbix agent:
# apt-get install zabbix-agent
Zabbix is now installed. The next step is to configure the database to store the data.
Configure MySQL for Zabbix
We need to create a new MySQL database, which Zabbix will use to store the collected data.
Start the MySQL shell:
$ mysql -uroot -p
Next:
mysql> CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
Query OK,1 row affected(0.00 sec)
mysql> GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY 'usr_strong_pwd';
Query OK,0 rows affected,1warning(0.00 sec)
mysql> EXIT;
Bye
Next, import the initial table and data.
# zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p zabbix
Enter the password of the zabbix user created in the MySQL shell.
Next, we need to edit the Zabbix server configuration file, which is /etc/zabbix/zabbis_server.conf
:
# $EDITOR /etc/zabbix/zabbix_server.conf
Search for the DBPassword
part of the file:
### Option: DBPassword
# Database password. Ignored for SQLite.
# Comment this line if no password is used.
#
# Mandatory: no
# Default:
# DBPassword=
Uncomment the line DBPassword=
and add the password created in MySQL:
DBPassword=usr_strong_pwd
Next, look for the line DBHost=
and uncomment it.
Save and exit.
Configure PHP
We need to configure PHP to use Zabbix. During the installation process, the installer created a configuration file named apache.conf
in /etc/zabbix
. Open this file:
# $EDITOR /etc/zabbix/apache.conf
At this point, just uncomment date.timezone
and set the correct time zone:
< IfModule mod_php7.c>
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 always_populate_raw_post_data -1
php_value date.timezone Europe/Rome
< /IfModule>
Save and exit.
At this point, restart Apache and start the Zabbix Server service so that it can be started at boot:
# systemctl restart apache2
# systemctl start zabbix-server
# systemctl enable zabbix-server
Use systemctl
to check Zabbix status:
# systemctl status zabbix-server
This command should output:
â zabbix-server.service - Zabbix Server
Loaded:loaded(/lib/systemd/system/zabbix-server.service; enabled; vendor pr
Active:active(running)...
At this point, the server side of Zabbix has been installed and configured correctly.
Configure Zabbix web frontend
As mentioned in the introduction, Zabbix has a web-based front end that we will use to visualize the collected data. However, this interface must be configured.
Using a web browser, enter the URL http://localhost/zabbix
.
Click Next step
Make sure all the values are Ok, then click Next step again.
Enter the MySQL zabbix user password, and then click Next step.
Click Next step and the installer will display a page with all configuration parameters. Check again to make sure everything is correct.
Click Next step to enter the last page.
Click Finish to complete the front-end installation. The default user name is Admin and the password is zabbix.
Getting started with Zabbix server
After logging in with the above credentials, we will see the Zabbix panel:
Go to Administration -> Users to get an overview of enabled accounts:
Create a new account by clicking Create user.
Click Add in Groups, and then select a group:
Save the new user credentials and it will be displayed in the Administration -> Users panel.
Please note that in Zabbix, host access rights are assigned to user groups, not individual users.
to sum up
We have finished the tutorial of Zabbix Server installation. Now, the monitoring infrastructure is ready to complete its work and collect data about the servers that need to be added to the Zabbix configuration.
The above is the whole content of this article, I hope it will be helpful to everyone's study.
Recommended Posts