Zabbix deployment,
Originally published in cu:
Reference:
I. Environment
Server: CentOS-7-x86_64-1511
Server IP: 192.168.11.252
Web Environment: CentOS-7-x86_64-1511 compilation nginx-1.9.12 + mysql-5.7.11 + php-7.0.4
Client: Win7 x86_64, Chrome/Firefox
2. software acquisition
Zabbix Official Website: http://www.zabbix.com/download.php
As of, the latest LTS version: http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.0.1/zabbix-3.0.1.tar.gz
3. Install zabbix1. iptables settings
# Zabbix_agent port 10050. The agent uses the passive mode by default and is actively connected to the agent by the server. The active mode of the agent can be configured in the agent configuration file. # zabbix_trapper port 10051, the agent connects to the server in active or trapper mode [root @ localhost ~] # Vim/etc/sysconfig/iptables-a input-p tcp-m state -- state NEW-m tcp -- dport 10051-j ACCEPT-A OUTPUT-p tcp-m state -- state NEW- m tcp -- dport 10050-j ACCEPT
2. Create/import a database
# Go To the mysql database creation Script directory and list the files with schema. SQL, images. SQL, data. SQL three files cd/usr/local/srctar-zxvf zabbix-3.0.1.tar.gzcd/usr/local/src/zabbix-3.0.1/database/mysqlll # enter the password, go to the MySQL console mysql-u root-p # create a database zabbix and use utf8create database zabbix character set utf8; # create an account zabbix with a password of 123456, refresh the System Authorization Table create user zabbix identified by '000000'; flush privileges; # Allow zabbix accounts to connect to the database zabbixgrant all on zabbix from the local machine. * to 'zabbix' @ '127. 0.0.1 'identified by '000000' with grant option; flush privileges; # enter the mysql database to view the newly created zabbix account and its permission database zabbixuse mysql; select host, user from user; # enter the zabbix database, import the script file to the zabbix database, important: please be sure to import use zabbix; source/usr/local/src/zabbix-3.0.1/database/mysql/schema in the following order. sqlsource/usr/local/src/zabbix-3.0.1/database/mysql/images. sqlsource/usr/local/src/zabbix-3.0.1/database/mysql/data. SQL # or directly import mysql-uzabbix-p123456-hlocalhost zabbix </usr/local/src/zabbix-3.0.1/database/mysql/schema in the system. sqlmysql-uzabbix-p123456-hlocalhost zabbix </usr/local/src/zabbix-3.0.1/database/mysql/images. sqlmysql-uzabbix-p123456-hlocalhost zabbix </usr/local/src/zabbix-3.0.1/database/mysql/data. SQL # different system versions and file versions may be different. Here it is 18.0.0; The libmysqlclient_r.so.x.0.0 file may not be found, and the cd/usr/lib64/mysqlln-s libmysqlclient is not affected. so.18.0.0 libmysqlclient. soln-s libmysqlclient_r.so.18.0.0 libmysqlclient_r.so
3. Deploy zabbix to add users
# Create a user zabbix and add the user zabbix to the user group zabbix groupadd zabbixuseradd-g zabbix-s/sbin/nologin zabbix
Dependency package
# If the following software package has been installed during Web environment LNMP installation, skip this step to install yum install net-snmp-devel curl-devel mysql-devel
Install zabbix
# Libiconv may not be found. so.2 file, no impact on ln-s/usr/local/lib/libiconv is found. so.2/usr/lib/libiconv. so.2 # Make the configuration take effect immediately/sbin/ldconfig # find/-name mysql_config find the location, if there is no mysql_config, you need to install yum install mysql-develcd/usr/local/src/zabbix-3.0.1. /configure -- prefix =/usr/local/zabbix -- enable-server -- enable-agent -- with-net-snmp -- with-libcurl -- enable-proxy -- with-mysql =/usr /bin/mysql_configmakemake installln-s/usr/local/zabbix/sbin/*/usr/local/sbin/ln-s/usr/local/zabbix/bin/*/usr/ local/bin/
Configure add Port
# Add the port corresponding to the zabbix service, vim/etc/services # emerge-agent 10050/tcp # Zabbix Agentzabbix-agent 10050/udp # Zabbix Agentzabbix-trapper 10051/tcp # Zabbix Trapperzabbix-trapper 10051 is added to the default services documentation /udp # Zabbix Trapper
Modify zabbix configuration file
# Zabbix configuration file vim/usr/local/zabbix/etc/users = zabbixDBUser = zabbixDBPassword = 123456 ListenIP = users =/usr/local/zabbix/share/zabbix/alertscripts # Enabled custom key sub-configuration file path, and enable vim/usr/local/zabbix/etc/zabbix_agentd.confInclude =/usr/local/zabbix/etc/zabbix_agentd.conf.d/UnsafeUserParameters = 1
Add boot script
# Server cp/usr/local/src/zabbix-3.0.1/misc/init. d/fedora/core/zabbix_server/etc/rc. d/init. d/zabbix_server # client cp/usr/local/src/zabbix-3.0.1/misc/init. d/fedora/core/zabbix_agentd/etc/rc. d/init. d/zabbix_agentd # Add the script execution permission chown zabbix: zabbix/etc/rc. d/init. d/zabbix_serverchown zabbix: zabbix/etc/rc. d/init. d/zabbix_agentdchmod + x/etc/rc. d/init. d/zabbix_serverchmod + x/etc/rc. d/init. d/zabbix_agentd # edit the installation directory of zabbix in the server startup script vim/etc/rc. d/init. d/zabbix_serverBASEDIR =/usr/local/zabbix/# edit the zabbix installation directory vim/etc/rc in the client STARTUP script. d/init. d/zabbix_agentdBASEDIR =/usr/local/zabbix/# Add boot start chkconfig-level 35 zabbix_server onchkconfig-level 35 zabbix_agentd on
Configure a web site
# Unzip the template cp-r/usr/local/src/zabbix-3.0.1/frontends/php/usr/local/nginx/html/zabbix #/usr/local/nginx/html nginx default site directory, www is the nginx Running Account chown-R www: www/usr/local/nginx/html/zabbix # start zabbix server/client service zabbix_server startservice zabbix_agentd start
Modify php configuration file Parameters
# All parameters are required for zabbix web installation. The following zabbix will detect vim/etc/php during startup and installation. inipost_max_size = 16Mmax_execution_time = 300max_input_time = 300vim/usr/local/php/etc/php-fpm.d/www. confrequest_terminate_timeout = 300 # restart php-fpmservice php-fpm reload
Install zabbix web
Open http: // 192.168.11.252/zabbix in the browser
During the first running, the system automatically redirects to setup. php for web installation.
Next step
Zabbix web installation detects the installation environment. Only after the installation is complete can you perform the next installation.
As shown in the following figure, the check shows that one item has not passed the check,
Parameter: always_populate_raw_post_data failed,
Zabbix will automatically detect this parameter, but php5.6 does not. you can modify it as follows:
# Comment out the original 76 ~ Line 78, add the above lines, when php version is greater than 5.6 ignore this detection # https://blog.memotz.com/276.htmlvim/usr/local/nginx/html/zabbix/include/classes/setup/CFrontendSetup. php // check for deprecated PHP 5.6.0 option 'always _ populate_raw_post_data '# if (version_compare (PHP_VERSION, '5. 6', '> =') {# $ result [] = $ this-> checkPhpAlwaysPopulateRawPostData () ;#} if (version_compare (PHP_VERSION, '5. 6', '> =') & version_compare (PHP_VERSION, '7. 0.4 ',' <') {$ result [] = $ this-> checkPhpAlwaysPopulateRawPostData () ;}$ result [] = $ this-> checkPhpSockets ();
Refresh detection after modification, pass, Next step
Configure the database information, just enter the information according to the previous configuration,NOTE: If localhost fails at the database host, you can check whether zabbix grants the corresponding permissions to the host localhost. If not, you can add the localhost host or modify the localhost on the configuration page to 127.0.0.1.
After modification, refresh the detection and pass.
Next step
You can set a zabbix server name by default.
Next step
Next step
Installation is complete. Finish.
Zabbix logon page. Default Account/password: admin/zabbix
Zabbix server startup Problems
After logging on to zabbix, focus on the status VALUE of zabbix server in the Dashboard. Sometimes zabbix does not run, and the VALUE is No, in this case, you can view the location of the log file in the/tmp/zabbix_server.log file (specify the location of the log file in the configuration file/usr/local/zabbix/etc/zabbix_server.conf ), zabbix_server cannot be started normally due to mysql permission issues.
4. Zabbix optional is used to modify the system configuration file so that the web page can be displayed in simplified Chinese.
Vim/usr/local/nginx/html/zabbix/include/locales. inc. php 'zh _ cn' => array ('name' => _ ('Chinese (zh_CN) '), 'display' => false), changed: 'zh _ cn' => array ('name' => _ ('Chinese (zh_CN) '), 'display' => true ),
Replace the default font of the monitored Image
The default font does not support Chinese characters. If it is not replaced, garbled characters are displayed on the image.
A Chinese font file, such as msyh. ttf,
Upload the font file msyh. ttf to the fonts folder under the root directory of the zabbix site, such as/usr/local/nginx/html/zabbix/fonts.
# Back up the default font file and modify msyh. ttf to DejaVusSans. ttfmv DejaVusSans. ttf DejaVusSans. ttf-bakmv msyh. ttf DejaVusSans. ttf.
Modify Display language
Log on to zabbix, Administrator à User à Admin (the font is related to the account), and change the Language to Chinese (zh_CN ).
Click update to exit the site and log on again.