Install Zabbix on CentOS7

Source: Internet
Author: User
Tags import database

Install Zabbix on CentOS7

I. Introduction to Zabbix

Zabbix is an enterprise-level open-source solution that provides distributed system monitoring and network monitoring functions based on the WEB interface.

Zabbix can monitor various network parameters to ensure secure operation of server systems. It also provides a flexible notification mechanism for system administrators to quickly locate and solve various problems.

Zabbix consists of two parts: zabbix server and the optional component zabbix agent.

Zabbix server can monitor the remote server/network status and collect data through SNMP, zabbix agent, ping, and port monitoring. It can run on many platforms.

Ii. Basic component Installation

Zabbix installation requires a LAMP environment.

# Yum installphp php-gd php-mysql php-bcmath php-mbstring php-xmlcurl curl-devel net-snmp-devel perl-DBI

# Yum install httpd mariadb *

Iii. Database Configuration

# Systemctl start mariadb. service

# Mysql-u root-p

Enter password: # Enter the MySQL password, which is empty by default.

MariaDB [(none)]> create database zabbix character set utf8;

# Create a database zabbix and use utf8 for database Encoding

MariaDB [(none)]> insert into mysql. user (Host, User, Password) values ('localhost', 'zabbix', password ('zabbix'); # create an account zabbix and a Password zabbix

MariaDB [(none)]> flush privileges; # refresh system authorization

MariaDB [(none)]> grant all on zabbix. * to 'zabbix' @ '127. 0.0.1 'identified by 'zabbix' with grant option; # Allow the account to connect from the local machine to the database zabbix

MariaDB [(none)]> flush privileges;

Iv. installation and configuration of zabbix

① Download and compile and install

# Wgethttp: // response

# Tar-zxvf zabbix-2.4.5.tar.gz

# Cd zabbix-2.4.5

#. /Configure -- with-mysql =/usr/bin/mysql_config -- with-net-snmp -- with-libcurl -- enable-server -- enable-agent -- enable-proxy -- prefix =/usr /local/zabbix

-- Prefix ----> specify the zabbix installation directory

-- Enable-server ----> supports zabbix servers
-- Enable-agent ----> supports zabbix proxy
-- Enable-proxy ----> supports zabbix proxy Server

-- With-libcurl ----> use the curl package

-- With-net-snmp ----> use the net-snmp package to selectively specify the path NET-SNMP Configuration

-- With-mysql =/usr/bin/mysql_config using the MySQL client library, you can select the specified path mysql_config


Note: The configure: error: MySQL library not found error occurs because the software package mariadb-devel is missing and yum install mariadb-devel is installed.

# Make

# Make install

② Import database

# Mysql-u root-p

MariaDB [(none)]> use zabbix;

MariaDB [zabbix]> source/root/zabbix-2.4.5/database/mysql/schema. SQL

MariaDB [zabbix]> source/root/zabbix-2.4.5/database/mysql/data. SQL

MariaDB [zabbix]> source/root/zabbix-2.4.5/database/mysql/images. SQL

MariaDB [zabbix]> quit

Note: Follow the preceding steps to import data. Otherwise, an error may occur.

③ Add the port corresponding to the server (which can be omitted)

[Root @ localhost ~] # Cat/etc/services | grep zabbix

Zabbix-agent 10050/tcp # Zabbix Agent // Client

Zabbix-agent 10050/udp # Zabbix Agent

Zabbix-trapper 10051/tcp # Zabbix Trapper // server

Zabbix-trapper 10051/udp # Zabbix Trapper

④ Copy the relevant configuration file to/etc and modify the configuration.

[Root @ localhost ~] # Mkdir-p/etc/zabbix

[Root @ localhost ~] # Cp-r zabbix-2.4.5/conf/*/etc/zabbix/

[Root @ localhost ~] # Chown-R zabbix: zabbix/etc/zabbix

[Root @ localhost ~] # Ln-s/usr/local/zabbix/etc/zabbix/

[Root @ localhost ~] # Ln-s/usr/local/zabbix/bin/*/usr/bin/

[Root @ localhost ~] # Ln-s/usr/local/zabbix/sbin/*/usr/sbin/

A). Modify zabbix_server.conf.

[Root @ localhost ~] # Vi/etc/zabbix/zabbix_server.conf

The modification is as follows:

[Root @ localhost ~] # Cat/etc/zabbix/zabbix_server.conf | grep-n ^ [^ #]

30: LogFile =/tmp/zabbix_server.log # log file address

68: DBHost = localhost # Database Host

78: DBName = zabbix # Database Name

94: DBUser = zabbix # database username

102: DBPassword = zabbix # Database Password

282: ListenIP = 127.0.0.1 # Database IP Address

425: AlertScriptsPath =/usr/local/zabbix/share/zabbix/alertscripts # directory where zabbix runs scripts

B) modify zabbix_agentd.conf.

[Root @ localhost ~] # Vi/etc/zabbix/zabbix_agentd.conf

The modification is as follows:

[Root @ localhost ~] # Cat/etc/zabbix/zabbix_agentd.conf | grep-n ^ [^ #]

11: PidFile =/tmp/zabbix_agentd.pid # process PID

21: LogFile =/tmp/zabbix_agentd.log # log storage location

59: EnableRemoteCommands = 1 # Allow Remote Command Execution

81: Server = 127.0.0.1 # ip address of the agent

122: ServerActive = 127.0.0.1

133: Hostname = Zabbix server # It must be the same as the hostname created by zabbix

252: Include =/usr/local/etc/zabbix_agentd.conf.d/

265: UnsafeUserParameters = 1 # Start the custom key

5. Modify PHP Parameters

# Vi/etc/php. ini

384 max_execution_time = 300

394 max_input_time = 300

405 memory_limit = 128 M

800 upload_max_filesize = 2 M

878 date. timezone = Asia/Shanghai

672 post_max_size = 28 M

6. configure a web site

# Cd zabbix-2.4.5/

# Cp-r frontends/php/var/www/html/zabbix

② Modify httpd. conf Parameters

# Vi/etc/httpd/conf/httpd. conf

163 <IfModule dir_module>

164 DirectoryIndex index.html index. php

165 </IfModule>

③ Disable SELinux:

A. temporarily shut down (no need to restart the machine ):

# Setenforce 0 # Set SELinux to permissive mode (disable SELinux)

# Setenforce 1 # Set SELinux to enforcing mode (enable SELinux)

B. To modify the configuration file, restart the machine:

# Vi/etc/selinux/config

Change SELINUX = enforcing to SELINUX = disabled

Machine needs to be restarted

7. Install the web interface

# Systemctl start httpd. service

Enter http: // 127.0.0.1/zabbix in the browser to enter the zabbix web configuration page ====

(For example, all OK) NEXT ===="

Configure the MySQL database information and click the "Test connection" button, for example, OK ==== "NEXT ===="

By default, direct NEXT ====

By default, an error occurs directly NEXT ====, prompting Fail (forgot)

Configuration file "/var/www/html/zabbix/conf/zabbix. conf. php"

Created: Fail

Unable to create the configuration file. Please install it manually, or fix permissions on the conf directory.

Press the "Download configuration file" button, download the configuration file and save it as "/var/www/html/zabbix/conf/zabbix. conf. php "When done, press the" Retry "button

Click the Download configuration file button as prompted, and save the downloaded zabbix. conf. php

/Var/www/html/zabbix/conf/and click "Retry" to Retry ====

OK is displayed. Click "Finish" to complete the installation.

The default account of Zabbix is admin and the password is zabbix.

Zabbix is in English version by default. Change the language ======, Profile

In Language, select zh_CN and click Update.

==== "Changed to Chinese

8. Add boot script

# Cd zabbix-2.4.5/

# Cp misc/init. d/fedora/core5/zabbix_server/etc/rc. d/init. d/zabbix_server

# Cp misc/init. d/fedora/core5/zabbix_server/etc/rc. d/init. d/zabbix_agentd

# Chmod u + x/etc/rc. d/init. d/zabbix_server

# Chmod u + x/etc/rc. d/init. d/zabbix_agentd

# Chkconfig zabbix_server on

# Chkconfig zabbix_agentd on

#/Usr/local/zabbix/sbin/zabbix_server start

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.