Linux/centos without network environment installation Zabbix

Source: Internet
Author: User
Tags auth mysql version openssl snmp upload php disk usage

Zabbix is an enterprise-class open source solution that provides distributed system monitoring and network monitoring capabilities based on a web interface.
Zabbix can monitor various network parameters, ensure the safe operation of the server system, and provide a flexible notification mechanism to enable system administrators to quickly locate/resolve various problems.
Zabbix consists of 2 parts, Zabbix server and optional Components Zabbix agent.
Zabbix server can be used Snmp,zabbix agent,ping, port monitoring and other methods to provide remote server/network status monitoring, data collection and other functions, it can run in Linux,solaris,hp-ux,aix,free BSD, Open Bsd,os x and other platforms.

Installation use

The Zabbix agent needs to be installed on the target server being monitored, and it mainly completes the collection of information such as hardware information or operating system-related memory, CPU, etc. Zabbix agent can run in Linux,solaris,hp-ux,aix,free bsd,open BSD, OS X, TRU64/OSF1, Windows NT4.0, Windows (2000/2003/xp/vista ) and other systems.
Zabbix server can independently monitor the service status of the remote server, and can also cooperate with the Zabbix agent, polling the Zabbix agent to actively receive the monitoring data (agent mode), but also passively receive Zabbix The data sent by the agent (trapping mode).
In addition, Zabbix Server supports SNMP (V1,V2), which can be used in conjunction with SNMP software (for example, NET-SNMP).

Build Zabbix Monitoring Environment

To build a Zabbix work environment, you need to start with the server. To communicate with the server, the administrator needs to use a Zabbix front-end interface to communicate with the Zabbix server and database. Three keys (interfaces, servers, and databases) can be installed on the same server, but if you have a larger and more complex environment, installing them on different hosts is also an option. Zabbix servers can directly monitor devices on the same network, and if other network devices also need to be monitored, a ZABBIX proxy server is required.

Characteristics

Main features of Zabbix:
Simple installation and configuration, low learning costs
Multi-lingual support (including Chinese)
Free Open Source
Autodiscover Server and network devices
Distributed monitoring and web centralized management capabilities
can be monitored without agents
User security authentication and soft licensing methods
setting or viewing monitoring results from the Web interface
email and other notification functions
Zabbix main functions:

CPU Load
Memory usage
Disk usage
Network status
Port monitoring
Log monitoring.

Introduced

This article installs the zabbix3.4.8 version on the centos6.8-64 bit system

All software used in this article add the bottom QR code for free

This paper is to build zabbix3.4.8 in LNMP environment.

Nginx Version: 1.9.3 Source compilation installation

MySQL version: 5.6.32 source compilation installation

PHP Version: 5.6.9 source compilation installation

Zabbix Version: 3.4.8 Source compilation installation

Start installation below

System Environment Preparation

Shutting down the firewall

Service Iptables Stop

Chkconfig iptables off

Turn off SELinux

Setenforce 0

Vim/etc/sysconfig/selinux//Modify the following

Configure local Yum

Configure the local Yum source, if the machine has a network Yum source, this step ignores

Upload Centos6.8 system image to server directory:/data/zabbix

Mount System Mirror Disk

mkdir/data/yum/

Mount-o Loop/data/zabbix/centos-6.8-x86_64-bin-dvd1.iso/data/yum

Df–h//Mount the following as shown below

Create a new directory, copy all the contents of the image, because there are some package system image in the later installation of the RPM package is not, this time need to go to the network yum source to download the package and then to our local Yum source to place the RPM package, the system disk mount is not allowed to write, So we mount it and copy all the files to a new directory.

The operation is as follows:

Mkdir/data/yumserver

cp–r/data/yum/*/data/yumserver/

After copying, we go to configure Yum, the operation is as follows

cd/etc/yum.repos.d/

mkdir Bak

CP *./bak

Vim Yum.repo//file contents can be copied and pasted as follows

[Base]

Name=yumserver

Enabled=1

baseurl=file:///data/yumserver/

Gpgcheck=0

Yum List//If there are many packages stating Yum is available

Start installation

Nginx Installation

Software Release: Version 1.9.3

Upload nginx-1.9.3.tar.gz to server directory:/USR/LOCAL/SRC

Installing a dependency package with Yum

Yum install gcc zlib zlib-devel OpenSSL openssl-devel pcre pcre-develncurse -y

(Note: Yum installation package on the way, if the error said that the package did not go to the Internet server to access the following address, Ctrl+f search error packet name, missing the package to find that, download and upload to the server directory:/data/yumserver/packages

Then continue with the installation. Installing PHP and Zabbix below may also be necessary to download the RPM package

RPM Package: http://mirrors.163.com/centos/6/os/x86_64/Packages/

Example:

Cd/usr/local/src

Tar-zxvf/usr/local/src/nginx-1.9.3.tar.gz

CD nginx-1.9.3

./configure--prefix=/usr/local/nginx--with-http_realip_module--with-http_sub_module--with-http_gzip_static_ Module--with-http_stub_status_module--with-pcre--with-http_ssl_module

Make && make install

Start method

/usr/local/nginx/sbin/nginx

can also be/etc/init.d/nginx start|stop|restart way

Upload the Nginx boot script in the attachment to/etc/init.d/

chmod 755/etc/init.d/nginx//Empowerment

Chkconfig--add nginx//Add Nginx for system service

Chkconfig Nginx on//configure boot from

MySQL Installation

Software version MySQL-5.6.32

Upload mysql-5.6.32-linux-glibc2.5-x86_64.tar.gz to server directory:/USR/LOCAL/SRC (package see attachment)

Cd/usr/local/src

TAR-ZXVF mysql-5.6.32-linux-glibc2.5-x86_64.tar.gz

MV Mysql-5.6.32-linux-glibc2.5-x86_64/usr/local/mysql

Groupadd MySQL

useradd-g MySQL MySQL

Cd/usr/local/mysql

Mkdir/usr/local/mysql/data/tmp

Chown-r Mysql:mysql/usr/local/mysql/data

./scripts/mysql_install_db--user=mysql--datadir=/usr/local/mysql/data--basedir=/usr/local/mysql

VIM/ETC/MY.CNF//Copy the following:

[Mysqld]

Datadir=/usr/local/mysql/data

Socket=/usr/local/mysql/data/mysql.sock

Character_set_server=gbk

User=mysql

Default-storage-engine=innodb

Tmpdir=/usr/local/mysql/data/tmp

Symbolic-links=0

Innodb_buffer_pool_size= 1G

Skip-name-resolve

Event_scheduler= 1

Port= 3306

Server_id= 1

wait_timeout=2880000

interactive_timeout= 2880000

max_allowed_packet= 512M

Join_buffer_size= 128M

Sort_buffer_size= 2M

Read_rnd_buffer_size= 2M

Lower_case_table_names= 1

Sql_mode=no_engine_substitution,strict_trans_tables

[Mysqldump]

Quick

max_allowed_packet= 512M

[Client]

Default-character-set=gbk

Socket=/usr/local/mysql/data/mysql.sock

CP Support-files/mysql.server/etc/init.d/mysqld

chmod 755/etc/init.d/mysqld

Add the following at the beginning of the VIM/ETC/INIT.D/MYSQLD//file

Basedir=/usr/local/mysql

Datadir=/usr/local/mysql/data

Chkconfig--add mysqld//Add MySQL to system service

Chkconfig mysqld on//set MySQL boot from boot

Service mysqld start//startup MySQL

PHP Installation

Upload php-5.6.9.tar.gz to server directory:/USR/LOCAL/SRC

Cd/usr/local/src

TAR-ZXVF php-5.6.9.tar.gz

LN-SV php-5.6.9 PHP

CD php/

./configure \

-prefix=/usr/local/php\

-with-config-file-path=/usr/local/php/etc\

-enable-inlin\

-disable-e-optimizationdebug \

-disable-rpath\

-enable-shared\

-enable-opcache\

-enable-fpm\

-with-mysql=/data/mysql\

-with-mysqli=/data/mysql/bin/mysql_config\

-with-pdo-mysql=/data/mysql\

-with-gettext\

-enable-mbstring\

-with-iconv\

-with-openssl\

-enable-bcmath\

-enable-soap\

-with-libxml-dir\

-enable-pcntl\

-enable-shmop\

-enable-sysvmsg\

-enable-sysvsem\

-enable-sysvshm\

-enable-sockets\

-with-curl\

-with-zlib\

-enable-zip\

-with-bz2\

-with-gd\

-with-freetype-dir\

-with-jpeg-dir\

-with-png-dir

(Note: The configuration process may be due to different circumstances, error missing RPM package, the error message copy and paste Baidu, see what package is missing, and then to download the online yum installed)

Make && make install

PHP.ini is a PHP running core configuration file

Php-fpm.conf is the configuration file for the PHP-FPM process service

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

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

CP SAPI/FPM/INIT.D.PHP-FPM/ETC/INIT.D/PHP-FPM

chmod +x/etc/init.d/php-fpm

FPM Test PHP configuration

/usr/local/php/sbin/php-fpm–t

#chkconfig--add PHP-FPM

#chkconfig PHP-FPM on

#service php-fpm Start

Configure nginx+php

Configure PHP

#vim/usr/local/php/etc/php-fpm.conf//Modify the following items

user = www

Group = www

Listen = 10.42.221.56:8000 #使用真实ip

Edit the PHP INI file and modify the following content

#vim/usr/local/php/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

Configure Nginx

#vim/usr/local/nginx/conf/nginx.conf//Modify the following content

User www;

server_name 10.42.221.56;

root/usr/local/nginx/html;

Location ~ ^/.*.php$ {

       root /usr/local/nginx/html;       fastcgi_pass   10.42.221.56:8000;       fastcgi_index  index.php;       fastcgi_param SCRIPT_FILENAME   $document_root$fastcgi_script_name;       include        fastcgi_params;

#vim/usr/local/php/etc/php-fpm.conf//Modify the following two items

user = www

Group = www

#groupadd www

#useradd –g www www

#cd/usr/local/nginx/html/

#vim index.php//write the content below

<?php phpinfo ();?>

Finally restart Nginx and PHP-FPM

#/usr/local/nginx/sbin/nginx–s Reload

#service php-fpm Restart

Access to http://ip/index.php appears stating success

Zabbix Installation

#tar-ZXVF zabbix-3.4.8.tar.gz

#cd zabbix-3.4.8

Set up the Web front end

#mkdir/usr/local/nginx/html/zabbix

#cp-R zabbix-3.4.3/frontends/php/*/usr/local/nginx/html/zabbix

To set Nginx execution and owner

#chown-R Www.www/usr/local/nginx/html/zabbix

Give executable permission

#chmod-R 755/usr/local/nginx/html/zabbix/
Create Zabbix users and Groups
#groupadd Zabbix
#useradd-G Zabbix Zabbix
Compiling and installing Zabbix
#./configure--enable-server--enable-agent--with-mysql=/data/mysql/bin/mysql_config--enable-ipv6--enable-java-- With-net-snmp--with-libcurl--with-libxml2--with-unixodbc--with-ssh2--with-openipmi--with-openssl--prefix=/usr/ Local/zabbix
Compilation success will occur

#make Install

Modifying a configuration file zabbix_server.conf

#vim/usr/local/zabbix/etc/zabbix_server.conf//Modify the following content

Dbname=zabbix

Dbuser=zabbix

Dbpassword=zabbix

#cp Zabbix-3.4.8/misc/init.d/fedora/core/zabbix_server/etc/init.d/zabbix_server

#cp Zabbix-3.4.8/misc/init.d/fedora/core/zabbix_agentd/etc/init.d/zabbix_agentd

Modify/etc/init.d/zabbix_server,/etc/init.d/zabbix_agentd basedir=/usr/local/to Basedir=/usr/local/zabbix

Enter the database, just installed MySQL password is empty, directly enter the line

#mysql –u Root

Mysql>create DATABASE Zabbix CHARACTER SET UTF8 COLLATE utf8_bin;

Mysql>grant all privileges on . To ' Zabbix ' @ ' localhost ' identifiedby ' Zabbix ';

Mysql>use Zabbix;

Mysql>source Zabbix-3.4.8/database/mysql/schema.sql;

Mysql>source Zabbix-3.4.8/database/mysql/images.sql;

Mysql>source Zabbix-3.4.8/database/mysql/data.sql;

Restart all services

Start Nginx

#/usr/local/nginx/sbin/nginx–s Reload

Restart database

#service mysqld Restart

Start Zabbix_server and Zabbix_agent

#/etc/init.d/zabbix_server start

#/etc/init.d/zabbix_agentd start

Set Zabbix boot

#chkconfig--add/etc/init.d/zabbix_server

#chkconfig--add/etc/init.d/zabbix_agentd

#chkconfig Zabbix_server on

#chkconfig Zabbix_agentd on

The browser accesses the Zabbix page and initializes it






Zabbix Implementing Mail Alerts
Installing plugins
Install the Mail sending tool MAILX
#yum –y Install MAILX Dos2unix
Configuration
Modify/etc/mail.rc to copy the following:
#vim/etc/mail.rc
Set Sendcharsets=iso-8859-1,utf-8
Set [email protected] #发件人邮箱地址
Set smtp=smtp.163.com #smtp服务器地址
Set [email protected] #认证用户
Set Smtp-auth-password=xxxxxxxxx #认证密码
Set Smtp-auth=login

To modify the Zabbix Master Profile zabbix_server.conf, add the following line
#vim/etc/zabbix/zabbix_server.conf
Alertscriptspath=/usr/lib/zabbix/alertscripts

New Mail Send script sendmail.sh
#cd/usr/lib/zabbix/alertscripts
#vim sendmail.sh//Copy the following:
#!/bin/bash
File=/tmp/mailtmp.txt
echo "$ $" > $FILE
Dos2unix-k $FILE
Mail-s "$" $ < $FILE
#chmod 755 sendmail.sh
#chown Zabbix.zabbix sendmail.sh
#touch/tmp/mailtmp.txt
#chmod 755/tmp/mailtmp.txt
#chown Zabbix.zabbix/tmp/mailtmp.txt
Configure Web pages
Create Media type

Manage –> Alarm Media type –> Create media type


Click Update when you are done with the icon, and you will see the type of email you just created in the alarm media type
Adding an alarm medium to the user

Here to Admin user for example Management –> user –> Click Admin

Click on the alarm vector and add the message recipient.

Create an action




Configuration complete

The list of actions will be displayed when the add is complete.
The corresponding trigger is not added at this time, and if any of the machines in the system have an alarm message, it will be sent to the corresponding mailbox via the Mail sender.

Then we create a new monitor, listen to the Zabbix Port 22 if the 22 port is listening, send an email alert

Email alert content is as follows:

If you have any questions about this article, please add the following discussion

Linux/centos without network environment installation Zabbix

Related Article

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.