[Practical exercise] using the Linux operating system 08- zabbix3.4 building monitoring system

Introduced in front of other people using the website code, build websites and services through the lamp / tomcat. When building web services, we need to focus on the health of the site, make sure the site works to provide services.

We need, server hardware, virtual machines, operating systems and application software (apache, tomcat, mysql) which started operating conditions by monitoring real-time monitoring system.

The open source zabbix, officially a very powerful, rich monitoring template free open source monitoring system, this introduction zabbix3.4 version of the installation.


lab environment:

Operating System: CentOS6.5

Database: Mysql5.7

Zabbix Version: 3.4


1, preparation:

selinux closed and disabled

Installation Mysql5.7 database (abbreviated: Reference [practice] drills Linux operating system 06-Mysql5.7 installation https://blog.51cto.com/14423403/2416054 )

Database creation and authorization

mysql -u root -p

Creating zabbix library, specify the character set

create database zabbix character set utf8 collate utf8_bin;

Zabbix create a user password: zabbix authorize all rights to have access to the library zabbix

grant all privileges on zabbix.* to zabbix@localhost identified by '1qaz!QAZ';

Refresh rights

flush privileges;

Check whether the database was created successfully

show databases;

001.png

2, PHP installation:

Add source yum install php

rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm

Note webtatic the repo inside https to delete s, otherwise the application installation is unsuccessful

Before installing php, you need to prepare in advance these libraries

yum install gcc-c++ glibc.i686 libstdc++* t1lib -y


3, install php

yum -y install httpd php56w php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml php56w-ldap

 

4, the configuration modification php

Note that each of which has relevant content, the value may be just right, or preceded by; No. commented out.

vim /etc/php.ini
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = Asia/Shanghai
always_populate_raw_post_data = -1


5, the configuration modification apache

vim /etc/httpd/conf/httpd.conf
ServerName 127.0.0.1
DirectoryIndex index.html index.html.var index.php
/etc/init.d/httpd start

 

6 , create zabbix user

groupadd zabbix
useradd -g zabbix zabbix


7, downloads the installation package zabbix, extract, introduced sql

Zabbix direct the browser to download the source code package, and then upload winscp (wget can, but very slow download)

wget https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.4.7/zabbix-3.4.7.tar.gz

Then extract

tar -zxvf zabbix-3.4.7.tar.gz
cd zabbix-3.4.7/database/mysql/
ls data.sql images.sql schema.sql

 The file is the database table zabbix need to use the export file, you need to import to the database zabbix

mysql -uzabbix -p zabbix < schema.sql 
mysql -uzabbix -p zabbix < images.sql 
mysql -uzabbix -p zabbix < data.sql

Many installation tutorial, the lack of a database table to import this step, zabbix could not complete installation, this step must have.

 

8, installation zabbix

Zabbix compiled before installation, you must install the following libraries, or can not successfully compile and install

yum install gcc -y
yum install mysql-devel -y
yum install libxml2-devel -y
yum install unixODBC-devel -y
yum install net-snmp-devel -y
yum install libssh2-devel -y
yum install OpenIPMI-devel -y
yum install libevent-devel -y
yum install pcre* -y
yum install curl-devel -y
cd /zabbix-3.4.7

Compile and install

./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-unixodbc --with-ssh2 --with-openipmi --with-openssl --prefix=/usr/local/zabbix

installation

make install

 9, the configuration modification zabbix

vim /usr/local/zabbix/etc/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix

10, create a new web front-end file

mkdir /var/www/html/zabbix

Move to the next source directory just created, the page code copied to the apache directory

cd /zabbix-3.4.7/frontends/php/
cp -rf * /var/www/html/zabbix/

 Setting Apache as a Web user interface to the file's owner

chown -R apache:apache /var/www/html/zabbix

Add permissions to Zabbix Web interface to perform file

chmod +x /var/www/html/zabbix/conf/

 Add Zabbix Zabbix proxy server and startup scripts

cp /zabbix-3.4.7/misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_server
cp /zabbix-3.4.7/misc/init.d/fedora/core/zabbix_agentd /etc/init.d/zabbix_agentd

Add Zabbix Zabbix server and proxy services

chkconfig --add /etc/init.d/zabbix_server
chkconfig --add /etc/init.d/zabbix_agentd
chkconfig httpd on
chkconfig mysqld on
chkconfig zabbix_server on
chkconfig zabbix_agentd on


11, start zabbix_server

/etc/init.d/zabbix_server start # error
Starting zabbix_server:  /etc/init.d/functions: line 546: /usr/local/sbin/zabbix_server: No such file or directory[FAILED]

 You need to change the path

vim /etc/init.d/zabbix_server
BASEDIR=/usr/local/zabbix

  Restart zabbix_server

/etc/init.d/zabbix_server start
Starting zabbix_server:                                    [  OK  ]

 Similarly, zabbix_agentd also need to modify the path, and then start

vim /etc/init.d/zabbix_agentd
BASEDIR=/usr/local/zabbix

 Start zabbix_agentd

/etc/init.d/zabbix_agentd start
Starting zabbix_agentd:                                    [  OK  ]


Login http: // ip / zabbix to access zabbix, is initialized.

002.png

003.png

004.png

005.png

006.png

007.png

The default user name and password Admin / zabbix

008.png

009.png

Guess you like

Origin blog.51cto.com/14423403/2416246