Zabbix distributed monitoring environment fully compiled installation deployment

Source: Internet
Author: User
Tags snmp

Many documents use Yum to install tools such as MySQL, HTTP, and PHP. Here uses the source installation form, realizes the entire record from the Lnmp-zabbix.

First, LNMP platform construction

Reference: http://www.ttlsa.com/nginx/nginx-install-on-linux/

http://swht1278.blog.51cto.com/7138082/1623886

Installation of 1.nginx

1.1 Environment-dependent deployments

Yum-y install gcc gcc-c++ autoconf automake zlib zlib-devel OpenSSL openssl-devel pcre-devel pcre-static gd-*

1.2 Setting up Nginx users and user groups

Groupadd-r nginx && useradd-s/sbin/nologin-g nginx-r nginx

1.3 Download the latest Nginx installation package

Wget-p/usr/local/src/http://nginx.org/download/nginx-1.9.1.tar.gz

1.4 Compiling and installing Nginx

cd/usr/local/src/&& Tar XF nginx-1.9.1.tar.gz

./configure--prefix=/usr/local/nginx--lock-path=/usr/local/nginx/nginx.lock--user=nginx--group=nginx-- With-http_ssl_module--with-http_flv_module--with-http_stub_status_module--with-http_gzip_static_module-- http-client-body-temp-path=/usr/local/nginx/client/--http-proxy-temp-path=/usr/local/nginx/proxy/-- http-fastcgi-temp-path=/usr/local/nginx/fcgi/--http-uwsgi-temp-path=/usr/local/nginx/uwsgi-- http-scgi-temp-path=/usr/local/nginx/scgi--with-pcre--with-file-aio--with-http_image_filter_module && Make && make install

1.5 Nginx Startup script

==============================

Vim/etc/init.d/nginx chmod +x/etc/init.d/nginx

#!/bin/bash

#

# Startup script for Nginx-this script starts and stops the Nginx daemon

#

# Chkconfig:-85 15

# Description:nginx is an HTTP (s) server, HTTP (s) reverse proxy and IMAP/POP3 proxy server

# Processname:nginx

# config:/usr/local/nginx/conf/nginx.conf

# Pidfile:/usr/local/nginx/logs/nginx.pid

# Source function library.

. /etc/rc.d/init.d/functions

# Source Networking configuration.

. /etc/sysconfig/network

# Check that networking are up.

["$NETWORKING" = "no"] && exit 0

nginx= "/usr/local/nginx/sbin/nginx"

prog=$ (basename $nginx)

Nginx_conf_file= "/usr/local/nginx/conf/nginx.conf"

[-f/etc/sysconfig/nginx] &&. /etc/sysconfig/nginx

Lockfile=/var/lock/subsys/nginx

Start () {

[-X $nginx] | | Exit 5

[-F $NGINX _conf_file] | | Exit 6

Echo-n $ "Starting $prog:"

Daemon $nginx-C $NGINX _conf_file

Retval=$?

Echo

[$retval-eq 0] && Touch $lockfile

Return $retval

}

Stop () {

Echo-n $ "Stopping $prog:"

Killproc $prog-quit

Retval=$?

Echo

[$retval-eq 0] && rm-f $lockfile

Return $retval

}

Restart () {

Configtest | | Return $?

Stop

Sleep 1

Start

}

Reload () {

Configtest | | Return $?

Echo-n $ "Reloading $prog:"

Killproc $nginx-hup

Retval=$?

Echo

}

Force_reload () {

Restart

}

Configtest () {

$nginx-T-C $NGINX _conf_file

}

Rh_status () {

Status $prog

}

Rh_status_q () {

Rh_status >/dev/null 2>&1

}

Case "$" in

Start

Rh_status_q && Exit 0

$

;;

Stop

Rh_status_q | | Exit 0

$

;;

Restart|configtest)

$

;;

Reload

Rh_status_q | | Exit 7

$

;;

Force-reload)

Force_reload

;;

Status

Rh_status

;;

Condrestart|try-restart)

Rh_status_q | | Exit 0

;;

*)

echo $ "Usage: $ start|stop|status|restart|condrestart|


Try-restart|reload|force-reload|configtest} "

Exit 2

Esac

==================================================

1.6 Nginx Start-up and shutdown

Service Nginx Start|reload|restart|stop

Chkcofnig Nginx on

Or:

Start/usr/local/nginx-1.5.1/sbin/nginx

Close/usr/local/nginx-1.5.1/sbin/nginx-s Stop

Restart/usr/local/nginx-1.5.1/sbin/nginx-s Reload

Installation of 2.mysql

Reference: Binary source package installation MySQL connection http://www.ttlsa.com/mysql/install-mysql5_6/

Custom compiled source package installation MySQL connection: http://swht1278.blog.51cto.com/7138082/1658992

2.1 Compilation Environment installation (for Linux systems with minimal installation)

Yum-y install wget gcc* make OpenSSL openssl-devel openssl-clients ncurses-devel-y && yum groupinstall "Develop ment Tools "

2.2 MySQL Source download

Wget-p/usr/local/src/http://cdn.mysql.com/downloads/mysql-5.6/mysql-5.6.20.tar.gz

#wget-P/usr/local/src/http://mirrors.sohu.com/mysql/mysql-5.6/mysql-5.6.25.tar.gz

Wget-p/usr/local/src/http://down1.chinaunix.net/distfiles/cmake-2.8.10.2.tar.gz

2.3 Source Installation CMake compilation environment

cd/usr/local/src/&& Tar XF cmake-2.8.10.2.tar.gz

CD cmake-2.8.10.2 &&./configure--prefix=/usr/local/cmake && make && make install

Vim/etc/profile

#set CMake

Export path== $PATH:/usr/local/cmake/bin

Source/etc/profile

2.4 Source Installation mysql-5.6

Groupadd MySQL && useradd-r-G mysql-s/etc/nologin MySQL # (create MySQL user does not need password and login system)

Mkdir-p/home/mysql/data && Mkdir/home/mysql/var

cd/usr/local/src/&& Tar XF mysql-5.6.20.tar.gz && CD mysql-5.6.20

CMake. -dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/home/mysql/data-dsysconfdir=/etc-dwith_innobase_ Storage_engine=1-dwith_archive_storage_engine=1-dwith_blackhole_storage_engine=1-dwith_readline=1-dwith_ssl= System-dwith_zlib=system-dwith_libwrap=0-dmysql_unix_addr=/home/mysql/var/mysql.sock-ddefault_charset=utf8- Ddefault_collation=utf8_general_ci && make && make install

Compile error resolution reference: HTTP://BLOG.163.COM/SZ2273_PR/BLOG/STATIC/41264296201361354426670/

Environment variable Configuration

Vim/etc/profile

Add export path= to the last line $PATH:/usr/sbin/:/usr/local/mysql/bin

Save Exit Execution: Source/etc/profile

2.5 Initializing the database

/usr/local/mysql/scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/home/mysql/data--user=mysql-- Default-storage-engine=myisam

2.6 Modifying the configuration file my.cnf

============================================

Vim/etc/my.cnf


[Client]

Default-character-set=utf8

#auto-rehash

Socket =/home/mysql/var/mysql.sock

[Mysqld]

# General #

user = MySQL

slave-skip-errors=1022,1032,1062

Basedir =/usr/local/mysql

Default-storage-engine = MyISAM

Socket =/home/mysql/var/mysql.sock

Pid-file =/home/mysql/var/mysql.pid

Port = 3306


# MyISAM #

Key_buffer_size = 1344M

Myisam_recover = Force,backup


# SAFETY #

Max_allowed_packet = 16M

Max_connect_errors = 1000000

Skip_name_resolve


# DATA STORAGE #

DataDir =/home/mysql/data

Long_query_time = 1


# BINARY LOGGING #

Log-bin =/home/mysql/data/mysql-bin.log

Expire-logs-days = 14

Sync-binlog = 1

Server-id = 1

Max_binlog_size = 500M


# REPLICATION #

Relay-log =/home/mysql/data/relay-bin.log

Slave-net-timeout = 60


# CACHES and LIMITS #

Tmp_table_size = 32M

Max_heap_table_size = 32M

Max_connections = 500

Thread_cache_size = 50

Open_files_limit = 65535

Table_definition_cache = 4096

Table_open_cache = 4096


# INNODB #

Innodb_data_file_path = Ibdata1:128m;ibdata2:10m:autoextend

Innodb_flush_method = O_direct

Innodb_log_files_in_group = 2

Innodb_lock_wait_timeout = 50

Innodb_log_file_size = 256M

Innodb_flush_log_at_trx_commit = 1

innodb_file_per_table = 1

Innodb_thread_concurrency = 8

Innodb_buffer_pool_size = 8G


# LOGGING #

Log-error =/home/mysql/data/mysql-error.log

Log-queries-not-using-indexes = 1

Slow-query-log = 1

Long_query_time = 1

Slow-query-log-file =/home/mysql/data/mysql-slow.log


# for SLAVE #

#binlog-format = ROW

#log-slave-updates = True

#gtid-mode = On

#enforce-gtid-consistency = True

#master-info-repository = TABLE

#relay-log-info-repository = TABLE

#sync-master-info = 1

#slave-parallel-workers = 2

#binlog-checksum = CRC32

#master-verify-checksum = 1

#slave-sql-verify-checksum = 1

#binlog-rows-query-log_events = 1

#report-port = 3306

#report-host = 10.1.1.10

============================================

2.7 MySQL startup and shutdown

CP Support-files/mysql.server/etc/init.d/mysql && chmod +x/etc/init.d/mysql

Service MySQL Start|stop|relaod|restart

Chkconfig MySQL on

3. PHP Compilation Installation

Reference: Nginx connection PHP 5.5 http://www.ttlsa.com/nginx/nginx-php-5_5/

3.1 Compiling the Environment installation

Yum install gcc make gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel-y

3.2 Source Package Download

Wget-p/usr/local/src/http://cn2.php.net/distributions/php-5.6.9.tar.gz

3.3 Compiling and installing php5.6.9

cd/usr/local/src/&& Tar XF php-5.6.9.tar.gz && CD php-5.6.9

./configure--prefix=/usr/local/php-5.6.9--with-config-file-path=/usr/local/php-5.6.9/etc--with-bz2--with-curl- -enable-ftp--enable-sockets--disable-ipv6--with-gd--with-jpeg-dir=/usr/local--with-png-dir=/usr/local-- With-freetype-dir=/usr/local--enable-gd-native-ttf--with-iconv-dir=/usr/local--enable-mbstring-- Enable-calendar--with-gettext--with-libxml-dir=/usr/local--with-zlib--with-pdo-mysql=mysqlnd--with-mysqli= Mysqlnd--with-mysql=mysqlnd--enable-dom--enable-xml--enable-fpm--with-libdir=lib64--enable-bcmath && Make && make install

3.4 Configuring PHP

CP Php.ini-production/usr/local/php-5.6.9/etc/php.ini

Cp/usr/local/php-5.6.9/etc/php-fpm.conf.default/usr/local/php-5.6.9/etc/php-fpm.conf

=================================

Open the php.ini configuration file, modify the following parameters as follows, otherwise Zabbix cannot be installed.

Max_execution_time = 300

Memory_limit = 128M

Post_max_size = 16M

Upload_max_filesize = 2M

Max_input_time = #这个参数修改是在文档的第383行, relevant information is described below in this document

Date.timezone PRC

==============================

3.5 Start PHP-FPM

/usr/local/php-5.6.9/sbin/php-fpm

3.6 Nginx Configuration

===============================

Location/

{

Try_files $uri $uri//index.php? $args;

}

Location ~. *\. (PHP)? $

{

Expires-1s;

Try_files $uri = 404;

Fastcgi_split_path_info ^ (. +\.php) (/.+) $;

Include Fastcgi_params;

Fastcgi_param path_info $fastcgi _path_info;

Fastcgi_index index.php;

Fastcgi_param script_filename $document _root$fastcgi_script_name;

#fastcgi_pass 127.0.0.1:9000;

Fastcgi_pass Unix:/var/run/phpfpm.sock;

}

=================================


Second, compile and install Zabbix

2.1 Environment-dependent installation

Yum Install Net-snmp-devel libxml2-devel libcurl-devel-y

2.2 Download Zabbix Source package

Wget-p/usr/local/src/http://jaist.dl.sourceforge.net/project/zabbix/zabbix%20latest%20stable/2.4.5/zabbix-2.4.5.tar.gz

2.3 Compiling and installing Zabbix

cd/usr/local/src/&& Tar XF zabbix-2.4.5.tar.gz && CD zabbix-2.4.5

./configure--prefix=/usr/local/zabbix-2.4.5/--enable-server--enable-agent--with-mysql--WITH-NET-SNMP-- With-libcurl--with-libxml2 && make && make install

2.4 Creating a user

Groupadd-r Zabbix && useradd-s/sbin/nologin-g zabbix-r Zabbix

2.5 Initializing the database

mysql-uroot-ppasswd

Mysql>create database Zabbix default CharSet UTF8;

mysql>quit;

MYSQL-UROOT-PPASSWD Zabbix < Database/mysql/schema.sql #初始化proxy库

#初始化server库

Mysql-uroot-p Zabbix < Database/mysql/images.sql

Mysql-uroot-p Zabbix < Database/mysql/data.sql

MySQL Setup password

$mysql

Mysql>use MySQL;

Mysql>update user Set Password=password (' yzkj2015 ') where user= ' root ';

mysql> flush Privileges;

2.6 Configuring Zabbix

Mkdir/etc/zabbix && CP conf/zabbix_server.conf/etc/zabbix/&& vim/etc/zabbix/zabbix_server.conf

==============

Dbname=zabbix

Dbuser=root

dbpassword=yzkj2015

dbport=3306

==============

2.7 Zabbix_server Start

/usr/local/zabbix-2.4.5/sbin/zabbix_server

2.8 Zabbix Client Configuration

Create user

Groupadd-r Zabbix && useradd-s/sbin/nologin-g zabbix-r Zabbix

Compiling the installation

cd/usr/local/src/&& Tar XF zabbix-2.4.5.tar.gz && CD zabbix-2.4.5

./configure--prefix=/usr/local/zabbix-2.4.5/--enable-agent && make && make install

Modifying a configuration file

Vim/usr/local/zabbix-2.2.2/etc/zabbix_agentd.conf

server=127.0.0.1 #被动接受某个IP地址的检查

serveractive=127.0.0.1 #主动将数据发送给该IP地址

Hostname=zabbix Server

Client Startup

/usr/local/zabbix-2.4.5/sbin/zabbix_agentd

2.9 Browser Installation

Copy of Web site files

Mkdir/home/zabbix && cp-rp/usr/local/src/zabbix-2.4.5/frontends/php/*/home/zabbix && cp/home/ zabbix/conf/zabbix.conf.php.example/home/zabbix/conf/zabbix.conf.php

Error PHP option max_input_time

Workaround: The reason is that the php.ini file contains two parameters, the first max_input_time default is-1, the second is the default is 60, need to be modified to 300

121; Max_input_time

122; Default Value:-1 (Unlimited)

123; Development value:60 (seconds)

124; Production value:60 (seconds)

Max_input_time = 300

383 Max_input_time = 300

Error: Error connecting to database:no such file or directory

The reason: Database host was written as localhost

FIX: Database type MySQL

Database host 127.0.0.1

Database Port 3306

Database name Zabbix

User Root #可以是zabbix, so secure, but remember the password to correspond

Password * * * *

Note: The configuration of this place can be modified in/home/zabbix/conf/zabbix.conf.php. The path is set according to its actual situation to find

2.10 Login Home page with default account

Admin

Zabbix

At this point, Zabbix of the source installation experiment completed, the next will be the Zabbix configuration to learn, please refer to another document.

Reference article: http://www.ttlsa.com/zabbix/install-zabbix-on-linux-5-ttlsa/

Disclaimer: This document is for learning purposes only, and for the reference article the author expresses his heartfelt thanks, this document is only the detailed parameter adjustment of the whole construction process, and conforms to our own production situation. Everyone crossing only attention to study is good ~




This article is from "Dolphin Watching" blog, please be sure to keep this source http://swht1278.blog.51cto.com/7138082/1659984

Zabbix distributed monitoring environment fully compiled installation deployment

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.