Zabbix installation and deployment and localization under CentOS

Build environment: Centos6.5_x86_64, Zabbix2.4.5, epel source

Server: ##

  1. Install the development package
    yum -y groupinstall "Development Tools"

  2. Install the required dependencies
    yum -y install httpd mysql mysql-server mysql-devel php php-mysql php-common
    php-mbstring php-gd php-odbc php-pear curl curl-devel net-snmp net-snmp-devel
    perl-DBI php-xml ntpdate php-bcmath

  3. Synchronize the server time, keep the time of all servers consistent to avoid unavailable monitoring data caused by time differences
    ntpdate pool.ntp.org

  4. Create users and groups required for running zabbix service
    groupadd -g 201 zabbix
    useradd -g zabbix -u 201 -m zabbix

  5. Initialize the mysql server
    /etc/init.d/mysqld start

  6. Create the database and user permissions required for zabbix operation
    mysqladmin -uroot -h127.0.0.1 password "chengshan"
    mysql -uroot -p
    mysql> create database zabbix character set utf8;
    mysql> grant all privileges on zabbix.* to zabbixuser@'%' identified by 'zabbixpwd';
    mysql> flush privileges;

  7. Download and unzip zabbix
    wget
    http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.4.5/zab
    bix-2.4.5.tar.gz/download
    tar xf zabbix-2.4.5.tar.gz

  8. Import the initial data of zabbix into the database
    cd zabbix-2.4.5
    mysql -uzabbixuser -h192.168.2.100 -p zabbix<database/mysql/schema.sql
    mysql -uzabbixuser -h192.168.2.100 -p zabbix<database/mysql/images.sql
    mysql -uzabbixuser -h192.168.2.100 -p zabbix<database/mysql/data.sql

Log in to the database to check whether the following table is created successfully

  1. Compile and install zabbix
    . /configure -sysconfdir=/etc/zabbix/ -enable-server -enable-agent -with-net-snmp

The path of the sysconfdir configuration file specified here is in the /etc/zabbix/ directory. If you do not specify it, it is

/usr/local/etc

  1. Copy the startup scripts of zabbixserver and agent, and set execution permissions
    cp misc/init.d/tru64/zabbix_agentd /etc/init.d/
    cp misc/init.d/tru64/zabbix_server /etc/init.d/
    chmod +x /etc/init.d/zabbix_*

  2. Copy the page file of zabbix to the specified directory (the same as the apache configuration)
    mkdir /var/www/html/zabbix
    cp -a frontends/php/* /var/www/html/zabbix/
    chown -R apache.apache /var/www/html/zabbix/

  3. Configure the php file to adapt to the parameters required for zabbix installation

vim /etc/php.ini

date.timezone = Asia/Shanghai #946 line
max_execution_time = 300 #440 line
max_input_time = 300 #449 line
post_max_size = 32M #729 line
memory_limit = 128M #457 line
mbstring.func_overload = 2 #1586 line, need to comment this line

  1. Configure the apache file and define the virtual host for installing and accessing zabbix

vim /etc/httpd/conf/httpd.conf

ServerName 127.0.0.1
< VirtualHost *:80>
DocumentRoot "/var/www/html"
ServerName 192.168.2.100
< /VirtualHost>

  1. Configure the files on the zabbix server side, define the IP, user name, and password of the database

vim /etc/zabbix/zabbix_server.conf

DBHost=192.168.2.100 #68 line
DBName = zabbix #78 line
DBUser=zabbixuser #94 line
DBPassword=zabbixpwd #102 line
DBSocket=/var/lib/mysql/mysql.sock #104 line
StartPollers=30 #127 line, open multi-thread number, general
No more than 30
StartTrappers=20 #156 lines, number of trapper threads
StartPingers=10 #164 line, the number of fping threads
StartDiscoverers=120 #172 line
ListenIP=0.0.0.0 #277 line
MaxHousekeeperDelete=5000 #307 line
CacheSize=1024M #324 line, used to save monitoring data
The number of caches, adjusted appropriately according to the number of monitoring hosts
StartDBSyncers=8 #340 line, database synchronization time
HistoryCacheSize=1024M #349 lines
TrendCacheSize=128M #358 line, total trend cache size
HistoryTextCacheSize=512M #367 line
AlertScriptsPath=/etc/zabbix/alertscripts #425 line
LogSlowQueries=1000 #467 line

  1. Start apache service and zabbix service
    /etc/init.d/httpd start
    /etc/init.d/zabbix_server start

  2. Access the installation interface and follow the prompts to complete the installation step by step
    http://192.168.2.100/zabbix/setup.php
    a) Enter the installation interface and click Next
    b) Ensure that all monitoring items are OK, click Next
    c) Fill in the user name, password, address and other information of the zabbix database, click Test connection, OK and then click Next
    d) Fill in the information of zabbix server, host name, port monitored by server program, host IP address, etc., if
    Server and web can be kept on the same server as default, click Next
    e) If there is no problem with the information filled in the previous sections, click Next
    f) Check the config file of the web program. If there is no problem, it will display OK. Just click Finish to complete the installation (such as
    If there is a problem here, it is generally a problem with the permissions of the zabbix virtual host directory file. The setting process above is generally not
    There will be problems)

If you fill in the database password or user name incorrectly due to a hand error, you will continue to report an error later, we can manually

Go to edit the configuration file vim /var/www/html/zabbix/conf/zabbix.conf.php to manually define the relevant parameters
Just count
g) Enter the login interface and click login, the default is admin zabbix

At this point, the server installation is complete

Agent side: ##

  1. Install the development package
    yum -y groupinstall "Development Tools"
    yum –y install ntpdate

  2. Synchronize the client time to prevent inconsistencies with the server side, resulting in unavailable monitoring data
    ntpdate pool.ntp.org

  3. Create users and groups required for zabbix operation
    groupadd -g 201 zabbix
    useradd -g zabbix -u 201 -m zabbix

  4. Unzip and install zabbixagent
    tar xf zabbix-2.4.5.tar.gz
    cd zabbix-2.4.5
    . /configure -sysconfdir=/etc/zabbix -enable-agent
    make && make install

  5. Scripts needed to run copy agent
    cp misc/init.d/tru64/zabbix_agentd /etc/init.d/
    chmod +x /etc/init.d/zabbix_agentd

  6. Configure the agent configuration file

vim /etc/zabbix/zabbix_agentd.conf #Do not write it here

zabbix_agent.conf, otherwise the configuration will not take effect
Server=192.168.2.100 #81 line, fill in the IP address of Server
ServerActive=192.168.2.100:10051 #122 line, modify it to the IP of Server
Address + port number
Hostname=192.168.2.100 #133 line, fill in the machine’s
HostName, note that the Server side must be able to resolve
UnsafeUserParameters=1 #265 line, whether custom key is allowed, 1
Is allowed, 0 is not allowed
Include= /etc/zabbix/zabbix_agentd.conf.d/ #249 line, custom agentd configuration file (key)
You can write here;

  1. Start zabbix agent
    /etc/init.d/zabbix_agentd start

Solve zabbix Chinese garbled and Chinese##

  1. Find a font you like in windows or download a font online

  2. Upload the font to the /var/www/html/zabbix/fonts directory. For example, I used "Chinese Songti Convention" here,
    The file name of the font stsong.ttf

  3. Modify the Chinese font settings of zabbix page management

vim /var/www/html/zabbix/include/defines.inc.php #Modify the following two lines

define('ZBX_FONT_NAME','stsong'); #92 line
define('ZBX_GRAPH_FONT_NAME','stsong'); #44 line

  1. The login page sets the default language of the corresponding user Administrator—->Users (please ensure that the user is displayed here,
    Otherwise, all user groups are displayed)

  2. Click the user name to enter the user information editing, the default language is simplified Chinese, and then click save to save

6、 refresh page

It has become Chinese, but English is still available in some places.

Recommended Posts

Zabbix installation and deployment and localization under CentOS
CentOs7 installation and deployment Zabbix3.4 original
Erlang 20.2 installation and deployment under CentOS 7
MySQL 8.0 installation, deployment and configuration under CentOS 6/7
Jenkins installation and deployment tutorial under CentOS 7
MySQL 8.0 installation and deployment under CentOS, super detailed!
Centos6.5 installation and deployment of KVM
Java-JDK installation and configuration under CentOS
Installation and use of Mysql under CentOS
Tomcat installation and configuration under CentOS 7 (Tomcat startup)
Centos-6.5 installation and deployment of LNMP environment
Installation and configuration of redis under centos7
Centos7 installation and deployment of gitlab server
CentOS7 installation zabbix 4.0 tutorial (graphics and text)
KVM installation and preliminary use under CentOS 7.2
Centos7 installation and deployment of Airflow detailed
Zabbix 2.2.20 installation details (Centos6.9)
Redis3 installation under Centos7
CentOS 7 installation and configuration graphic tutorials under VMware10
Installation and configuration of rsync server under CentOS 6.5
MySQL 8.0 installation, deployment and configuration tutorial on CentOS 8
[CentOS environment deployment] Java7/Java8 deployment under CentOS
Centos mysql installation and configuration
Redis cluster installation under CentOS
Centos7 installation and configuration prometheus
Installation and cracking of Jira7 operation records under Centos
CentOS installation and configuration cmake
Redis cluster installation under CentOS
centos7 kvm installation and use
CentOS7 postgresql installation and use
Centos7 elk7.1.1 installation and use
Detailed explanation of Spark installation and configuration tutorial under centOS7
Deployment of vulnerability scanning and analysis software Nessus under CentOS
Centos8 minimal deployment and installation of OpenStack Ussuri detailed tutorial
Centos7 installation and configuration of Jenkins
Install and configure keepalived under CentOS 5.9
Compile and install LAMP under Centos 5.2
Use Nginx and u under CentOS
RabbitMQ cluster deployment record under Centos6.9
Installation under centos6.9 of jenkins learning
Centos7 hadoop cluster installation and configuration
CentOS7 installation and maintenance of Gitlab
Upgrade OpenSSL and OpenSSH under CentOS7
Deploy and optimize Tomcat under Centos
Redis installation under ubuntu and windows
CentOS 7.X system installation and optimization
Install Python3 and ansible under CentOS8
Install and use docker under CentOS 6.8
CentOS 7 Tomcat service installation and configuration
CentOS NTP server installation and configuration
Install Python3 and Py under CentOS7
2-Kubernetes entry manual installation and deployment
FFmpeg environment deployment record under centos7
JumpServer Bastion Host--CentOS 8 Installation and Deployment (4)
Centos7 mysql database installation and configuration
PPTP environment deployment record under Centos
Install Mono 3.2 and Jexus 5.4 under CentOS 6.3
2019-07-09 CentOS7 installation
centos7_1708 installation
Tutorial diagram for installing zabbix2.4 under centos6.5
ubuntu Docker installation and deployment of Rancher