Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Deployment in production environment: zabbix3.2.1 (ubuntu system)

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

I. configuration

Role

IP

Hostnam

Virtual IP

Zabbixserver master node

10.36.1.55

Compute51

10.36.1.101

Zabbixserver slave node

10.36.1.56

Compute52

Mysql database master node

10.36.1.1

Controller1

10.36.1.100

Mysql database slave node

10.36.1.17

Controller2

II. Installation

This deployment is based on the official zabbix documentation.

Https://www.zabbix.com/documentation/3.0/manual/installation/install_from_packages

I. preparation of MYSQL database

In my production environment, there is already a high availability environment for mysql. I only need to create the libraries needed for zabbix.

1. Create a zabbix database

Shell > mysql-uroot-p

Mysql > create database zabbix character set utf8 collate utf8_bin

Mysql > grant all privileges on zabbix.* to zabbix@10.36.1.100 identified by 'zabbix'

Mysql > flush privileges

Mysql > quit

Description: 10.36.1.100 is the VIP address to access the database (that is, virtual IP, don't understand it as a VIP member)

Go back to the installation of zabbix server

1. Download zabbix_3.2.1.orig.tar.gz

Download link: http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix/zabbix_3.2.1.orig.tar.gz

2. Decompression

Tar-zxvf zabbix-3.2.0.tar.gz

3. Create a general account: zabbix is used to run the zabbix service

Groupadd zabbix

Useradd-g zabbix zabbix

4. Create a zabbix database

Just now, you have created a database named zabbix.

4.1.There comes the problem of egg pain. I said to test that you have no permission to log in to the database with the zabbix account.

Solution:

We did it before when we authorized it:

Grant all privileges on zabbix.* to zabbix@10.36.1.100 identified by 'zabbix'

Next, I log in to the database using root and execute:

Grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'

Flush privileges

Try logging in again:

Mysql-uzabbix-pzabbix

Nima, you can log in. OK, that's it. We'll talk about this later.

All right, then go ahead and import zabbix data into the zabbix database

First send the zabbix-3.2.1.tar.gz file scp to the / root/ directory of the database server, and then decompress it

Scp zabbix-3.2.1.tar.gz root@10.36.1.1:/root (the IP of my database master node is 10.36.1.1)

Then enter the directory / root/zabbix-3.2.1/database/mysql where the zabbix-3.2.1.tar.gz has been decompressed.

Root@compute51:~/zabbix-3.2.1/database/mysql# pwd

/ root/zabbix-3.2.1/database/mysql

Root@compute51:~/zabbix-3.2.1/database/mysql# ls-l

Total 3064

-rw-r--r-- 1 zabbix zabbix 1032494 Sep 30 17:47 data.sql

-rw-r--r-- 1 zabbix zabbix 1978341 Sep 30 17:43 p_w_picpaths.sql

-rw-r--r-- 1 zabbix zabbix 122134 Sep 30 17:47 schema.sql

Do you see three files? Never mind what it's for, let's import it!

Remember: pay attention to the import order schema-- > paired pictures-> data

Mysql-uzabbix-pzabbix zabbix < schema.sql

Mysql-uzabbix-pzabbix zabbix < p_w_picpaths.sql

Mysql-uzabbix-pzabbix zabbix < data.sql

After the import is complete, log in to the database to see if there is any data in the zabbix database

Mysql-uzabbix-pzabbix

Use zabbix

Show tables

freaking awesome! I can't believe it, so I won't take a screenshot here!

5. Let's start configuring the source

Configure Zabbix server and agent

. / configure-enable-server-enable-agent-with-mysql-with-libcurl-with-libxml2

This configuration, I will follow the official, I do not need too many functions, basically like this!

Sadly, the environment will be checked during configuration, but there are many dependent packages that have not been installed, so install the relevant dependent packages first.

Apt-get update

Apt-get-y install make

Apt-get-y install gcc

Apt-get-y install libghc-hsql-mysql-dev

Apt-get install libmysqlclient18

Apt-get-y install libxml2-dev

Apt-get install libcurl3-dev

Apt-get install libsnmp-dev

What exactly are some of the options in configure? Check out the help!

. / configure-- help

-- enable-ipv6 Turn on support of IPv6

-- enable-server Turn on build of Zabbix server

-- enable-agent Turn on build of Zabbix agent and client utilities

-- with-mysql [= ARG] use MySQL client library [default=no], optionally

Specify path to mysql_config

If you want to use Net-SNMP library:

-- with-net-snmp [= ARG] use Net-SNMP package [default=no], optionally

Specify path to net-snmp-config

If you want to use XML library:

-- with-libxml2 [= ARG] use libxml2 client library [default=no], optionally

Specify path to xml2-config

If you want to use cURL library:

-- with-libcurl [= DIR] use cURL package [default=no], optionally specify

Path to curl-config

6. Start the compilation and installation below

Make install

After the installation is completed, the default binary path to install the daemon is: (/ usr/local/sbin zabbix_server,zabbix_agentd zabbix_proxy)

Client in / usr/local/bin/ binary (zabbix_get zabbix_sender)

Of course, this is the default, and you can specify the installation directory with-- prefix when you configure

7. Check whether the configuration files exist after the installation is completed

/ usr/local/etc/zabbix_agentd.conf client file

/ usr/local/etc/zabbix_server.conf server file

8. Edit the zabbix_server.conf configuration file below to specify the database

# vim / usr/local/etc/zabbix_server.conf

DBHost=10.36.1.100 # I'm using a stand-alone database here

DBName=zabbix

DBUser=zabbix

DBPassword=zabbix

9. Go ahead, install the Zabbix web interface below

PHP file copy

The Zabbix front end is written in PHP, so it requires a PHP to support the network server to run. Installation is done by simply copying the PHP file of the network server from the front / PHP HTML document directory.

Common HTML document directory locations for Apache web servers include:

/ usr/local/apache2/htdocs (default directory when installing Apache)

/ srv/www/htdocs (OpenSUSE, SLES)

/ var/www/html (Fedora, RHEL, CentOS)

/ var/www (Debian, Ubuntu)

Install apache2 and copy the php file (php file is in the unzipped zabbix-3.2.1 directory)

Apt-get-y-install apache2

Cd var/www/html

Mkdir zabbix # create a directory

Chown zabbix:zabbix zabbix/ # sets this directory's

Cp-R / root/zabbix-3.2.1/frontends/php/* / var/www/html/zabbix

Install PHP5 and configure Zabbix front-end PHP

Apt-get install php5

Apt-get install php5-gd

Apt-get install php5-mysql

Vim / etc/php5/apache2/php.ini

Open the php.ini configuration file and then modify the configuration items as follows:

Php_value max_execution_time 300

Php_value memory_limit 128M

Php_value post_max_size 16M

Php_value upload_max_filesize 2M

Php_value max_input_time 300

Php_value always_populate_raw_post_data-1

# php_value date.timezone Europe/Riga (date.timezone = Asia/Shanghai # remove ";" and add Asia/Shanghai)

The reason for configuring the content in php.ini is to ensure that all software prerequisites are met.

10. Let's start installing the front end

Open http://10.36.1.55/zabbix/setup.php through Firefox

10.1. When you enter, you will see the welcome interface of zabbix3.2

Click netx step directly

10.2. Then go to the interface to check the prerequisites and select the next step after ensuring that all software prerequisites have been met.

10.3. Then come to the database configuration.

What I use here is a stand-alone database, and it is a set of mysql high availability that has been built before.

Do you remember carrying out this order before? Grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'

So now go to the two databases and execute the following commands:

Grant all privileges on zabbix.* to zabbix@slave identified by'zabbix'

Flush privileges

10.4. Let's start configuring the database information.

Databases host 10.36.1.100 (VIP)

Port 3306

Database name: zabbix

User:zabbix

Password:zabbix

So far, it's basically done.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report