Publish: 2017-11-29 | Modify: 2019-04-24
Zabbix is an enterprise-level open-source solution that provides distributed system monitoring and network monitoring functionality through a web interface. It is ideal for managing multiple servers and monitoring them using Zabbix. Zabbix consists of two parts, the Zabbix server and the optional component Zabbix agent.
To install Zabbix server, you will need PHP + MySQL support (SQLite, PostgreSQL, and other databases can also be used). Since your server already has the OneinStack (Linux + Nginx + MySQL + PHP) environment installed, it is recommended to install Zabbix server using the source code compilation method to avoid affecting the current environment.
yum -y install gcc gcc-c++ curl-devel mysql-devel curl-devel net-snmp net-snmp-devel
groupadd zabbix
and useradd -g zabbix zabbix
wget http://soft.xiaoz.org/linux/zabbix-3.4.4.tar.gz
tar -zxvf zabbix-3.4.4.tar.gz && cd zabbix-3.4.4
./configure --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2
and make install
Note: The latest stable version of Zabbix at the time of writing this article is 3.4. You can find the latest source code package on the official website. If you encounter an error during compilation such as "checking for mysql_config... configure: error: MySQL library not found", you can specify the location of mysql_config. For example: --with-mysql=/usr/local/mysql/bin/mysql_config
. If you still encounter errors, search and handle them based on the actual error message. After installing Zabbix server on CentOS 7, the configuration file paths are as follows:
/usr/local/etc/zabbix_server.conf
/usr/local/etc/zabbix_agentd.conf
Import database
zabbix-3.4.4/database/mysql
in the following order:
schema.sql
images.sql
data.sql
/usr/local/etc/zabbix_server.conf
and fill in the correct database account, password, and other information. Then start Zabbix server and Zabbix agent by running zabbix_server && zabbix_agentd
.Install web interface
zabbix-3.4.4/frontends/php
to your site directory. Access your domain http://domain.com/
and enter the basic information of your Zabbix server to complete the installation. After successful installation, you will see the login page with the username Admin
and password zabbix
. Remember to change the password after logging in.Setting Chinese language:
Fixing Chinese garbled characters:
C:\Windows\Fonts
directory on your computer and copy a Chinese language font file, such as simkai.ttf
, to the fonts
directory of your site. Rename the font file to DejaVuSans.ttf
. This will replace the default font used by Zabbix and fix the garbled characters issue.cd zabbix-3.4.4
cp misc/init.d/tru64/zabbix_server /etc/init.d/zabbix_server
cp misc/init.d/tru64/zabbix_agentd /etc/init.d/zabbix_agentd
chmod 755 /etc/init.d/zabbix_*
zabbix_server
and zabbix_agentd
and add the following lines at the beginning:
#chkconfig: 35 95 95
#description:zabbix Agent server
chkconfig --add zabbix_server
chkconfig --add zabbix_agentd
chkconfig zabbix_server on
chkconfig zabbix_agentd on
The basic installation is now complete. If you need to monitor data from other servers, you can install the Zabbix client using the official RPM package. The client does not require PHP/MySQL support, and it is recommended to install the client using the official RPM package for convenience.
Further reading
Summary
I come from China and I am a freelancer. I specialize in Linux operations, PHP, Golang, and front-end development. I have developed open-source projects such as Zdir, ImgURL, CCAA, and OneNav.