PS:
In fact, it is very simple to install zabbix. You can search a lot of online materials and basically install it in yum mode, which is simple and convenient. Because of this, I did not write the relevant configuration documents. The installation method is usually yum installation, source code installation or container installation. Recently, a netizen proposed it. I took it seriously and wrote the whole process of compiling and installing Linux Centos 7 Zabbix (Zabbix server). Later, I will also write some articles on the use and optimization of Zabbix.
Official recommendation:
Zabbix is an enterprise level distributed open source monitoring solution. It can monitor various network applications and server health and integrity software. The Zabbix server stores its data in a relational database supported by MySQL, MariaDB, PostgreSQL, or Oracle. All reports, statistics, and configuration parameters of Zabbix can be accessed and set through the Web based front-end page. And Zabbix is open source and free.
1. Installation environment (Hyper-V virtual machine):
$ hostnamectl Static hostname: localhost.localdomain Icon name: computer-vm Chassis: vm Machine ID: renwoles1d8743989a40cb81db696400 Boot ID: renwoles272f4aa59935dcdd0d456501 Virtualization: microsoft Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 3.10.0-514.2.2.el7.x86_64 Architecture: x86-64
2. Since the front end of the Zabbix UI is written in PHP, it must run on a Web server that supports the PHP scripting language. Prerequisites:
《 Centos 7 Compile and Install nginx 》
《 Production of Compiling and Installing PHP 7 in Centos 7 》
《 Linux JAVA JDK JRE environment variable installation and configuration 》
《 Centos 7 binary installation MariaDB (MySQL) database 》
3. If your server already has a PHP environment, please skip step 2 and continue with the following configuration:
Configuring php.ini must meet the following requirements:
max_execution_time = 300 max_input_time = 300 memory_limit = 128M post_max_size = 32M date.timezone = Asia/Shanghai mbstring.func_overload=2 #Zabbix PHP LDAP authentication is enabled (optional) extension = "/usr/local/php/lib/php/extensions/no-debug-zts-20160303/ldap.so"
4. Install dependent packages and create groups&users
$ yum -y install epel-release && yum -y update $ yum install -y net-snmp-devel OpenIPMI-devel libssh2-devel iksemel-devel $ groupadd zabbix $ useradd -g zabbix zabbix
5. Install Zabbix Server
Download address://www.zabbix.com/download
$ cd /tmp $ tar -zxvf zabbix-3.4.2.tar.gz $ cd zabbix-3.4.2 $ ./ configure --prefix=/usr/local/zabbix \ --sysconfdir=/usr/local/zabbix/etc \ --enable-server \ --enable-agent \ --with-mysql=/usr/bin/mysql_config \ --with-net-snmp \ --with-libcurl \ --with-libxml2 \ --enable-proxy \ --enable-ipv6 \ --enable-java \ --with-ssh2 \ --with-iconv \ --with-openipmi \ --with-ldap \ --with-openssl \ --with-jabber \ $ make $ make install
be careful: –enable-agent Optional, this parameter is mainly used for the client (the monitored).
Note: If you do not install the JAVA environment, please remove the – enable java option, which is mainly used to monitor Tomcat.
6. Create and grant Zabbix configuration file directory permission
$ mkdir -p /usr/local/zabbix/logs $ chown -R zabbix.zabbix /usr/local/zabbix
7. Copy the source code of the Zabbix UI front-end program to the Nginx Web directory
$ cp -rf /tmp/zabbix-3.4.2/frontends/php/* /apps/web/zabbix $ chown -R www.www /apps/web/zabbix
8. Create the database name: zabbix User: zabbix Password: renwolecom and give the user all permissions for the database:
$ mysql -uroot -p Enter password: (Enter the root database password and press Enter) MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@"%" identified by 'renwolecom'; MariaDB [(none)]> flush privileges; MariaDB [(none)]> quit;
9. Import Zabbix related structure table files into Zabbix database in order
Import order schema.sql table structure>images. sql image library>data.sql initial script
$ cd /tmp/zabbix-3.4.2/database/mysql $ mysql -uzabbix -prenwolecom zabbix < schema.sql $ mysql -uzabbix -prenwolecom zabbix < images.sql $ mysql -uzabbix -prenwolecom zabbix < data.sql
10. Configure zabbix_server.conf
The contents after configuration are as follows:
$ egrep -v "^$|^#|^;" /usr/local/zabbix/etc/zabbix_server.conf LogFile=/usr/local/zabbix/logs/zabbix_server.log PidFile=/usr/local/zabbix/zabbix_server.pid LogFileSize=0 DBHost=10.10.204.62 DBName=zabbix DBUser=zabbix DBPassword=renwolecom JavaGateway=10.10.204.62 JavaGatewayPort=10052 StartJavaPollers=5 StartPingers=4 Timeout=4 AlertScriptsPath=/usr/local/zabbix/share/zabbix/alertscripts LogSlowQueries=3000 Include=/usr/local/zabbix/etc/zabbix_server.conf.d/
be careful: Since the parameter configurations of each production environment are different, I only list the basic commonly used configuration files, View more configuration parameters 。
11. Create the system ctl system Zabbix servers unit file
$ vim /usr/lib/systemd/system/zabbix.service
[Unit] Description=Zabbix Server After=syslog.target After=network.target [Service] Environment="CONFFILE=/usr/local/zabbix/etc/zabbix_server.conf" EnvironmentFile=-/usr/local/zabbix/etc/zabbix_server.conf.d Type=forking Restart=on-failure PIDFile=/usr/local/zabbix/zabbix_server.pid KillMode=control-group ExecStart=/usr/local/zabbix/sbin/zabbix_server -c $CONFFILE ExecStop=/bin/kill -SIGTERM $MAINPID RestartSec=10s TimeoutSec=0 [Install] WantedBy=multi-user.target
12. Start zabbix and add automatic startup
$ systemctl start zabbix $ systemctl enable zabbix
13. Firewall Settings
$ firewall-cmd --permanent --add-port=10051/tcp $ firewall-cmd --permanent --add-port=80/tcp $ firewall-cmd --reload
Installation is complete.
Next, you can use IP Or domain name to access the Zabbix monitoring management system. For specific settings, please refer to Zabbix Server Web The wizard prompts you to set it.
After setting, the Zabbix default account: Admin password: zabbix (Note that the account is case sensitive) After login, it is an English interface. Just click the villain icon in the upper right corner (current user settings) to locate Language Items, selecting Chinese (zh_CN) , click Update You can switch to the Chinese interface.
For the Zabbix proxy client, see《 Centos 7 Zabbix Agent Client Source Code Compilation, Installation and Configuration 》。