Install zabbix monitoring based on lnmp Environment

Source: Internet
Author: User

 

This article describes how to set up zabbix in the lnmp environment. To reduce the configuration difficulty, MySQL and PHP are installed using yum.

This installation process is described in a direct and efficient manner.


1. Install MySql in yum

Install MySQL using yum

Yum install mysql-servermysql-devel MySQL

/Etc/init. d/mysqld start

 

2. install PHP in yum

The PHP configuration file after yum is installed is/etc/PHP. ini.

Yum install-y PHP-mysqlphp-Gd libjpeg * PHP-imap PHP-ldap php-odbc php-pear PHP-xml php-xmlrpcphp-mbstring PHP-mcrypt PHP-bcmath PHP- mhash libmcrypt-devel PHP-FPM

 

Sed-I's/^ user =. */user = nginx/G'/etc/php-fpm.d/www. conf

Sed-I's/^ group =. */group = nginx/G'/etc/php-fpm.d/www. conf

/Etc/init. d/PHP-FPM start

 

3. Compile and install nginx3.1 and install PCRE

PCRE is required for nginx installation.

Wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.33.tar.gz

Yum install GCC * # solve the problem of no GCC package Compilation

Tar-zxf pcre-8.33.tar.gz

CD pcre-8.33

./Configure

Echo $?

Make & make install

3.2 install nginx

Wget http://nginx.org/download/nginx-1.4.7.tar.gz

Useradd nginx-S/sbin/nologin-m

./Configure -- user = nginx -- group = nginx -- prefix =/usr/local/nginx -- with-http_stub_status_module -- with-http_ssl_module

Echo $?

Make & make install

 

3.3 test nginx

[[Email protected] #/usr/local/nginx/sbin/nginx-T

/Usr/local/nginx/sbin/nginx: Error while loading shared libraries: libpcre. so.1: cannot open shared objectfile: no such file or directory

 

Echo/usr/local/lib>/etc/lD. So. conf

Ldconfig

 

[[Email protected] #/usr/local/nginx/sbin/nginx-T

Nginx: the configuration file/usr/local/nginx/CONF/nginx. conf syntax is OK

Nginx: configuration file/usr/local/nginx/CONF/nginx. conf test is successful

# Enter the nginx IP address in the browser.


4. Configure nginx to associate with PHP

4.1Modify nginx configuration file

Add the following red content to nginx. conf:

VI/usr/local/nginx/CONF/nginx. conf

Server {

Listen 80;

SERVER_NAME localhost;

Location /{

Root HTML;

Index index.html index.htm index. php;

}

Location ~ \. Php $ {

Root HTML;

Fastcgi_pass 127.0.0.1: 9000;

Fastcgi_index index. php;

Fastcgi_param script_filename $ document_root $ fastcgi_script_name;

Include fastcgi_params;

Include FastCGI. conf;

}

}

# The red part is used to send the URL Ending with PHP to the PHP process for processing.

 

4.2 Add phpinfo

Create a phpinfo File

Cat>/usr/local/nginx/html/index. php <EOF

<? PHP

Phpinfo ();

?>

EOF


4.3 Test PHP Parsing

Enter test urlhttp: // ip/index. php In the browser. If the following interface appears, the resolution is successful.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/46/69/wKioL1PyH86h6DdJAAJDo4gLVoU232.jpg "style =" float: none; "Title =" inline "alt =" wkiol1pyh86h6ddjaajdo4glvou232.jpg "/>


5. Install zabbix Server

5.1 install zabbix ServerEnd

Yum-y install libcurl-develnet-SNMP-devel # depending on the actual situation in the system environment, if some libraries are missing, you can re-run yum

Useradd zabbix-S/sbin/nologin

 

CD/usr/local/src

Wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.2.2/zabbix-2.2.2.tar.gz/download

Tar zxf zabbix-2.2.2.tar.gz

CD zabbix-2.2.2

./Configure -- prefix =/usr/local/zabbix -- enable-server -- enable-agent -- With-mysql -- With-net-snmp -- With-libcurl

Make & make install

 

5.2 create a database and add an authorized account.

 

Create Database zabbix characterset utf8;

Grant all privileges on zabbix. * to [email protected] '% 'identified by 'zabbix ';

Delete from mysql. User whereuser = ""; # delete an empty User Name

Flush privileges;

 

5.3 import database

CD/usr/local/src/zabbix-2.2.2

Mysql-uzabbix-pzabbix-h127.0.0.1 zabbix <database/MySQL/Schema. SQL

Mysql-uzabbix-pzabbix-h127.0.0.1 zabbix <database/MySQL/images. SQL

Mysql-uzabbix-pzabbix-h127.0.0.1 zabbix <database/MySQL/data. SQL


5.4 copy zabbixStart File

Cpmisc/init. d/Fedora/CORE/zabbix_server/etc/init. d/

Cpmisc/init. d/Fedora/CORE/zabbix_agentd/etc/init. d/

 

5.5 modify the configuration file and Startup File

Sed-I's/^ dbuser =. * $/dbuser = zabbix/G'/usr/local/zabbix/etc/zabbix_server.conf

Sed-I's/^. * dbpassword =. * $/dbpassword = zabbix/G'/usr/local/zabbix/etc/zabbix_server.conf

Sed-I's/^. * dbhost =. * $/dbhost = 127.0.0.1/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


5.6 add zabbixService port

Cat>/etc/services <EOF

Zabbix-Agent 10050/tcp zabbixagent

Zabbix-Agent 10050/udp zabbixagent

Zabbix-Trapper 10051/tcpzabbix trapper

Zabbix-Trapper 10051/udpzabbix trapper

EOF


5.7 start zabbixService

/Etc/init. d/zabbix_serverstart

/Etc/init. d/zabbix_agentdstart

Echo "/etc/init. d/zabbix_serverstart">/etc/rc. Local

Echo "/etc/init. d/zabbix_agentdstart">/etc/rc. Local

 

Netstat-plnt | grep zabbix

TCP 0 0 0.0.0.0: 10050 0.0.0.0: * Listen 834/zabbix_agentd

TCP 0 0 0.0.0.0: 10051 0.0.0.0: * Listen 769/zabbix_server


5.8 copy WebEnd to nginxWorking directory

CD/usr/local/src/zabbix-2.2.2

CP-ra frontends/PHP // usr/local/nginx/html/zabbix

Chown-r nginx. nginx/usr/local/nginx/html/zabbix


5.9 enter http: // ip/zabbix/index. php In the browser

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/46/67/wKiom1PyHriSeGhTAAH0w2CGeH4096.jpg "Title =" %e0t%%elhtcc(1zy_%v_30g.jpg "style =" float: none; "alt =" percent "/>

 

5.10 modify PHPZabbixInstallation requirements

Sed-I's/^ \ (. * \) date. timezone =. * $/date. timezone = Asia \/Shanghai/G'/etc/PHP. ini
Sed-I's/^ \ (. * \) post_max_size =. * $/post_max_size = 16 m/G'/etc/PHP. ini
Sed-I's/^ \ (. * \) max_execution_time =. * $/max_execution_time = 300/G'/etc/PHP. ini
Sed-I's/^ \ (. * \) max_input_time =. * $/max_input_time = 300/G'/etc/PHP. ini
/Etc/init. d/PHP-FPM restart


650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/46/67/wKiom1PyHrbQmba2AAJQANd5LL4008.jpg "Title =" regular "style =" float: none; "alt =" wkiom1pyhrbqmba2aajqand5ll4008.jpg "/>

 

5.11 zabbixConnect to database

Enter the user name and password configured above:

Database Name: zabbix

Database username: zabbix

Database Password: zabbix

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/46/67/wKiom1PyHrzBkgDFAAIu8qz0oaU461.jpg "Title =" lqaumf7k] _ g ~ K'kmr1_seorj.jpg "style =" float: none; "alt =" wkiom1pyhrzbkgdfaaiu8qz0oau461.jpg "/>

  

5.12 log on to zabbix

Default User name: Admin

Default password: zabbix

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/46/69/wKioL1PyH9LzchKJAAF_tgbbOKI739.jpg "Title =" 828j1__fpd0c9o3'rpkpwm@a.jpg "style =" float: none; "alt =" regular "/>

 

6. Adjust zabbix to display Chinese Characters

Click "Profile" in the upper-right corner.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/46/69/wKioL1PyH9aDnGw4AAGst6LFdB4478.jpg "Title =" p89d320.large (8xgluw.umkw.hos8.jpg "style =" float: none; "alt =" wkiol1pyh9adngw4aagst6lfdb4478.jpg "/


7. Install zabbix client on centos

Useradd zabbix-S/sbin/nologin-m

 

Tar-zxf zabbix-2.2.2.tar.gz

CD zabbix-2.2.2

./Configure -- prefix =/usr/local/zabbix -- enable-agent

Make install

 

Cpmisc/init. d/Fedora/CORE/zabbix_agentd/etc/init. d/

# Modify the Server IP address in/usr/local/zabbix/etc/zabbix_agentd.conf

# Modify basedir in/etc/init. d/server_agentd

 

[[Email protected] # netstat-plnt | grep zabbix

TCP 0 0 0.0.0.0: 10050 0.0.0.0: * Listen 17870/zabbix_agentd

 

8. Install zabbix client on Ubuntu

Apt-Get install zabbix-agent

VI/etc/zabbix/zabbix_agentd.conf # modify the Server IP Address

 

If apt-Get fails to be installed, you can delete the zabbix-Agent package: dpkg-r zabbix-agent; dpkg-P zabbix-agent, and then install apt-Get.

 

9. Debian install zabbix Client

Tar-zxf zabbix-2.2.2.tar.gz

CD zabbix-2.2.2/

Ls

./Configure -- prefix =/usr/local/zabbix -- enable-agent

Make install

 

Cpmisc/init. d/Debian/zabbix-agent/etc/init. d

 

VI/usr/local/zabbix/etc/zabbix_agentd.conf # modify the Server IP Address

VI/etc/init. d/zabbix-Agent # specify the zabbix_agentd path

 

 

 

The zabbix server and client have been installed.




This article from the "this is my hometown" blog, please be sure to keep this source http://yangrong.blog.51cto.com/6945369/1541810

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.