Deployment of zabbix monitoring service

Keywords: Zabbix MySQL PHP Apache

zabbix monitoring service

  • zabbix: it is an enterprise level open source solution based on WEB interface that provides distributed system monitoring and network monitoring functions. It can monitor various network parameters to ensure the safe operation of the server system, and provide flexible notification mechanism to enable the system administrator to quickly locate / solve various problems.

Deploy zabbix

  • Because zabbix is developed in PHP, you must first deploy the lamp or lnmp architecture to enable it to run PHP web pages.
    Deployment of lamp architecture
zabbix server installation

Here is the server with the lamp architecture set up

//Install dependency package
[root@hxdserver ~]# yum -y install net-snmp-devel libevent-devel 
//Download zabbix
[root@hxdserver ~]# cd /usr/src/
[root@hxdserver src]# wget https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.4.12/zabbix-3.4.12.tar.gz
[root@hxdserver src]# tar xf zabbix-3.4.12.tar.gz
//Create zabbix users and groups
[root@hxdserver ~]# groupadd -r zabbix 
[root@hxdserver ~]# useradd -r -g zabbix -M -s /sbin/nologin zabbix

//Configure zabbix database
[root@hxdserver ~]# mysql -uroot -p
mysql> create database zabbix character set utf8 collate utf8_bin; 
Query OK, 1 row affected (0.32 sec)

mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix123!'; 
Query OK, 0 rows affected, 2 warnings (0.09 sec)

mysql> flush privileges; 
Query OK, 0 rows affected (0.05 sec)
mysql> quit
[root@hxdserver ~]# cd /usr/src/zabbix-3.4.12/database/mysql/ 
[root@hxdserver mysql]# mysql -uzabbix -pzabbix123! zabbix < schema.sql 
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@hxdserver mysql]# mysql -uzabbix -pzabbix123! zabbix < images.sql 
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@hxdserver mysql]# mysql -uzabbix -pzabbix123! zabbix < data.sql 
mysql: [Warning] Using a password on the command line interface can be insecure.

//Compile and install zabbix
[root@hxdserver ~]# cd /usr/src/zabbix-3.4.12 
[root@hxdserver zabbix-3.4.12]# ./configure --enable-server  --enable-agent  --with-mysql  --with-net-snmp  --with-libcurl  --with-libxml2
[root@hxdserver zabbix-3.4.12]# make install


zabbix server configuration
[root@hxdserver ~]# ls /usr/local/etc/ 
zabbix_agentd.conf    zabbix_server.conf
zabbix_agentd.conf.d  zabbix_server.conf.d
[root@hxdserver ~]# vim /usr/local/etc/zabbix_server.conf
DBPassword=zabbix123!  //Set zabbix database connection password

//Start ZABBIX? Server and ZABBIX? Agentd
[root@hxdserver ~]# zabbix_server
[root@hxdserver ~]# zabbix_agentd
[root@hxdserver ~]# ss -antl
State      Recv-Q Send-Q Local Address:Port               Peer Address:Port              
LISTEN     0      128          *:22                       *:*                  
LISTEN     0      100    127.0.0.1:25                       *:*                  
LISTEN     0      128          *:10050                    *:*                  
LISTEN     0      128          *:10051                    *:*                  
LISTEN     0      128    127.0.0.1:9000                     *:*                  
LISTEN     0      128         :::80                      :::*                  
LISTEN     0      128         :::22                      :::*                  
LISTEN     0      100        ::1:25                      :::*                  
LISTEN     0      80          :::3306                    :::* 


zabbix server web interface installation and configuration
zabbix web interface configuration before installation
//Modify the configuration of / etc/php.ini and restart PHP FPM
[root@hxdserver ~]# sed -ri 's/(post_max_size =).*/\1 16M/g' /etc/php.ini 
[root@hxdserver ~]# sed -ri 's/(max_execution_time =).*/\1 300/g' /etc/php.ini 
[root@hxdserver ~]# sed -ri 's/(max_input_time =).*/\1 300/g' /etc/php.ini 
[root@hxdserver ~]# sed -i '/;date.timezone/a date.timezone = Asia/Shanghai' /etc/php.ini 
[root@hxdserver ~]# service php-fpm restart 
Gracefully shutting down php-fpm . done
Starting php-fpm  done
[root@hxdserver ~]# cd /usr/src/zabbix-3.4.12 
[root@hxdserver zabbix-3.4.12]# mkdir /usr/local/apache/htdocs/zabbix 
[root@hxdserver zabbix-3.4.12]# cp -a frontends/php/* /usr/local/apache/htdocs/zabbix/
[root@hxdserver zabbix-3.4.12]# chown -R apache.apache /usr/local/apache/htdocs

//Configure apache virtual host
[root@hxdserver ~]# vim /etc/httpd24/httpd.conf
//Add the following
<VirtualHost *:80>
    DocumentRoot "/usr/local/apache/htdocs/zabbix"
    ServerName zabbix.dubai.com
    ProxyRequests Off
    ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/zabbix/$1
    <Directory "/usr/local/apache/htdocs/zabbix">
        Options none
        AllowOverride none
        Require all granted
    </Directory>
</VirtualHost>


// Set the zabbix/conf directory permission, so that ZABBIX has the permission to generate the configuration file zabbix.conf.php 
[root@hxdserver ~]# chmod 777 /usr/local/apache/htdocs/zabbix/conf
//Restart apache
[root@hxdserver ~]# apachectl -t
Syntax OK
[root@hxdserver ~]# apachectl restart

Installing the zabbix web interface
  • Modify the / etc/hosts file to add the mapping between domain name and IP
  • Access the domain name on the browser, zabbix.dubai.com
  • The permission to restore the zabbix/conf directory is 755

    Access domain name installation




Log in to zabbix

zabbix default login user name and password:

User name Password
Admin zabbix

Posted by loveitandhateit on Tue, 17 Dec 2019 10:19:56 -0800