LNMP environment Zabbix Compile installation steps detailed

Source: Internet
Author: User
Tags snmp create database


Because there is already a PHP running environment, you only need to compile and install Zabbix.
First, install dependent components


Yum-y Install NET-SNMP net-snmp-devel perl-dbi php-gd php-xml php-bcmath fping openipmi-devel php-mbstring

Ii. Compiling and installing Zabbix

①, download Zabbix


Cd/usr/local/src
Wget-o zabbix-2.4.3.tar.gz-c "http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.4.3/ Zabbix-2.4.3.tar.gz/download "

②, compiling installation


#解压zabbix
Tar zxvf zabbix-2.4.3.tar.gz

#编译zabbix
CD zabbix-2.4.3

./configure--prefix=/usr/local/zabbix--enable-server--with-mysql--with-net-snmp--with-libcurl- Enable-proxy--enable-agent

#成功将出现如下信息:
***********************************************************
* Now run ' make install ' *
*                                                         *
* Thank for using zabbix! *
*                     *
***********************************************************
#直接make install can be installed:

Make install
The following error may occur with Ps:configure:
A. Mysqlclient library not found:

Checking for mysql_config .../usr/bin/mysql_config
Checking for main in-lmysqlclient ... no
Configure:error:Not found Mysqlclient Library

After the soft link is established, recompile:

#如果是32位系统, should be lib32, in short, first look at the following path refers to the existence of the file:
Ln-s/usr/lib64/mysql/libmysqlclient.so.18.0.0/usr/lib64/mysql/libmysqlclient.so
Ln-s/usr/lib64/mysql/libmysqlclient_r.so.18.0.0/usr/lib64/mysql/libmysqlclient_r.so
B. MySQL Library not found:


Configure:error:MySQL Library not found

This is an error that has not been installed on the Mysql-devel component, first installed with Yum, and then recompiled:

Yum Install Mysql-devel

Third, the configuration Zabbix

Ps: The following steps, if not an absolute path, are located in the folder directory after Zabbix decompression, that is,/usr/local/src/zabbix-2.4.3
③, create the Zabbix database, and import the initial data

#创建zabbix数据库和zabbix用户
Mysql-uroot-proot password-E "CREATE database Zabbix default character set UTF8;"
Mysql-uroot-proot password-E "grant all privileges on zabbix.* to ' Zabbix ' @ ' localhost ' identified by ' zabbix2014 ' flush GES; "


#导入zabbix初始数据
Cat Database/mysql/schema.sql | mysql-uzabbix-pzabbix2014 Zabbix
Cat Database/mysql/images.sql | mysql-uzabbix-pzabbix2014 Zabbix
Cat Database/mysql/data.sql | mysql-uzabbix-pzabbix2014 Zabbix
③, modifying configuration

#创建服务
CP misc/init.d/fedora/core/zabbix_server/etc/init.d/
CP misc/init.d/fedora/core/zabbix_agentd/etc/init.d/

#修改参数, note that the DB user name and password are modified according to the actual situation:
Sed-i ' s/^dbuser=.*$/dbuser=zabbix/g '/usr/local/zabbix/etc/zabbix_server.conf
Sed-i ' s/^.*dbpassword=.*$/dbpassword=zabbix2014/g '/usr/local/zabbix/etc/zabbix_server.conf
Sed-i ' s/basedir=\/usr\/local/basedir=\/usr\/local\/zabbix/g '/etc/init.d/zabbix_server
Sed-i ' s/basedir=\/usr\/local/basedir=\/usr\/local\/zabbix/g '/etc/init.d/zabbix_agentd
④, deploying Web

#因为只是测试, so directly to the default, Http://ip/zabbix will be able to access the
Cp-r Frontends/php/home/wwwroot/default/zabbix

#修改权限
Chown-r Www:www/home/wwwroot/default/zabbix
⑤, add service port


#直接在终端执行如下命令行即可:
Cat >>/etc/services <<eof
Zabbix-agent 10050/tcp #Zabbix Agent
Zabbix-agent 10050/UDP #Zabbix Agent
Zabbix-trapper 10051/tcp #Zabbix Trapper
Zabbix-trapper 10051/udp #Zabbix Trapper
Eof

⑥, start Zabbix service


Service Zabbix_server Start
Service Zabbix_agentd Start

#可选配置: Add service to boot entry
Chkconfig Zabbix_server on
Chkconfig Zabbix_agentd on
Four, the web side of the installation

Because I was placed in the LNMP default directory, so directly in the browser to access the HTTP://IP address/zabbix into the Installation Wizard, and the general installation of the PHP site, like, very simple.

The next step is to detect the operating environment, if there is a red, self-examination and solve it, such as this time there is a hint:

Tip Max_input_time value should be changed to 300, so only need to edit php.ini, find Max_input_time and modify to 300, save after the implementation of service PHP-FPM restart, and then refresh the Installation Wizard has no problem, Continue to follow the wizard until the installation is complete:

When completed, enter the Zabbix login interface:

Enter default username: admin and Password: Zabbix can log in:

V. Problems and Solutions

①, monitor the error
After landing Zabbix, found that the instrument panel reported the following error:

Look down the background log:

[Root@lcoalhost ~]# tail-f/tmp/zabbix_server.log
9785:20150128:114951.637 [Z3001] connection to database ' Zabbix ' failed: [2002] Can ' t connect to local MySQL server Throug H socket '/var/lib/mysql/mysql.sock ' (2)
9785:20150128:114951.637 Database is down. Reconnecting in seconds.
9785:20150128:115001.638 [Z3001] connection to database ' Zabbix ' failed: [2002] Can ' t connect to local MySQL server Throug H socket '/var/lib/mysql/mysql.sock ' (2)
9785:20150128:115001.638 Database is down. Reconnecting in seconds.
...
It turns out to be a mysql.sock path problem.

Workaround:

Method (1). Modify/usr/local/zabbix/etc/zabbix_server.conf, find #dbsocket=/tmp/mysql.sock, uncomment:
Method (2). To establish a soft link:


test-d/var/lib/mysql | | Mkdir/var/lib/mysql
Ln-s/tmp/mysql.sock/var/lib/mysql/mysql.sock
Recommend the first method, save, use service Zabbix_server restart restart the Zabbix service to resolve this issue.

①, Chinese set
The steps to change to the Chinese interface are: Profile-> Language-> Chinese (ZH_CN)->save
But when I install, there is no Chinese (ZH_CN) this pull-down option.
Solution:
1, in the Zabbix website directory (/home/wwwroot/default/zabbix) to find include/locales.inc.php files
2, edit locales.inc.php, find


' ZH_CN ' => Array (' name ' => _ (' Chinese (zh_cn) '), ' display ' => false),

Modified to:


' ZH_CN ' => Array (' name ' => _ (' Chinese (zh_cn) '), ' Display ' => true),

Ps: Many of the language in the default is False shielding, want to turn on only need to change to true in the language configuration to open.
After modifying the Save, refresh the page, you can already find Chinese (ZH_CN):

②, graphic Chinese display as box
Because the monitored client has not been added, the monitoring of the server itself is opened first:
Step: Configuration (Configure)-> host-> activation host

When you enter a graphic, you find the text to be a box:

It appears to be a font problem, just replace it with a common font in Windows.
Specific steps:
1). I prefer Microsoft ya black, so under C:\windows\fonts to find Microsoft ya Black font: MSYH.TTC
2). Upload to Zabbix font directory:/home/wwwroot/default/zabbix/fonts/
3. Overwrite the default font file with MSYH.TTC Dejavusans.ttf:

1
Mv-f MSYH.TTC Dejavusans.ttf
Refresh page, already normal:
Zabbix monitoring in LNMP environment to compile and install the small note

All right, about the Zabbix server installation is recorded here, followed by the time to record the Zabbix client installation and use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.