zabbix分布式項(xiàng)目proxy

一、zabiix分布式原理圖:

zabbix分布式就相當(dāng)于在基礎(chǔ)環(huán)境中搭建了一個(gè)中轉(zhuǎn)站zabbix-porxy,porxy可以把其監(jiān)控項(xiàng)全部收納起來(lái),等待zabbix-server服務(wù)器的讀取。(用分布式項(xiàng)目?jī)?yōu)勢(shì),可以在內(nèi)網(wǎng)中對(duì)要進(jìn)行監(jiān)控的服務(wù)器進(jìn)行監(jiān)控)

zabbix分布式管理原理圖.png

二、準(zhǔn)備實(shí)驗(yàn)環(huán)境:

zabbix分布式管理環(huán)境部署圖.png

服務(wù)器角色 ip 服務(wù)器名
zabbix-server 10.0.0.71 zabbix
zabbix-proxy 10.0.0.7/172.16.1.7 web01
zabbix-agent 172.16.1.20 web02-jk

需要部署的程序:
zabbix-server 部署的程序:zabbix-server-mysql 、zabbix-web-mysql、mariadb-server、httpd(內(nèi)外網(wǎng)都需要)
zabbix-proxy 部署的程序:mariadb-server、zabbix-proxy(內(nèi)外網(wǎng)都需要)
zabbix-agent 部署的程序:zabbix-agent、把外網(wǎng)關(guān)閉(只保存內(nèi)網(wǎng)172.16.1.20)

1、 zabbix-server的搭建在第59課已經(jīng)有搭建過(guò),這里不做說(shuō)明。

2、 zabbix-proxy的環(huán)境部署(在web01上部署):

2.1 官網(wǎng)下載zabbix源:

image.png

2.2 修改zabbix.repo源:

[root@web01 yum.repos.d]# vim zabbix.repo 

[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=0

2.3 安裝zabbix-proxy:

[root@web01 yum.repos.d]# yum install -y zabbix-proxy-mysql
[root@web01 yum.repos.d]# rpm  -qa zabbix-proxy-mysql
zabbix-proxy-mysql-4.0.10-1.el7.x86_64

2.4 安裝mariadb-server:

[root@web01  ]# yum install -y mariadb-server
[root@web01 yum.repos.d]# rpm  -qa mariadb-server
mariadb-server-5.5.60-1.el7_5.x86_64

2.5 優(yōu)化數(shù)據(jù)庫(kù)(mysql安全初始化):

[root@zabbix yum.repos.d]# mysql_secure_installation 

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
     SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] n
... skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

2.6 創(chuàng)建數(shù)據(jù)庫(kù):

[root@web01 ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 37
Server version: 5.5.60-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database zabbix_proxy  charset utf8;
MariaDB [(none)]> grant  all on zabbix_proxy.*  to zabbix_proxy@localhost  identified  by '123456';
MariaDB [(none)]> select user,host from mysql.user;
+--------------+------------+
| user         | host       |
+--------------+------------+
| root         | 127.0.0.1  |
| bbs          | 172.16.1.% |
| root         | ::1        |
| bbs          | localhost  |
| root         | localhost  |
| zabbix_proxy | localhost  |
| root         | web01      |
+--------------+------------+
7 rows in set (0.02 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| bbs                |
| mysql              |
| performance_schema |
| test               |
| zabbix_proxy       |
+--------------------+
6 rows in set (0.00 sec)

2.7 導(dǎo)入初始化數(shù)據(jù)庫(kù)并啟動(dòng)數(shù)據(jù)庫(kù)、設(shè)置開機(jī)自啟:

[root@web01 ~]# zcat /usr/share/doc/zabbix-proxy-mysql-4.0.10/schema.sql.gz |mysql -uzabbix_proxy  -p123456  zabbix_proxy
[root@web01 ~]#systemctl  start  mariadb.server
[root@web01 ~]#systemctl  enable  mariadb.server

2.8 修改zabbix-proxy配置文件,啟動(dòng)proxy,并開機(jī)自啟:


84AAC784-8B7E-426b-A371-DFFDAC6CD622.png
[root@web01 ~]# systemctl  start zabbix-proxy
[root@web01 ~]# systemctl  enable  zabbix-proxy

2.9 修改zabbix-agent配置文件, 啟動(dòng)zabbix-agent服務(wù)并設(shè)置開機(jī)自啟:


zabiix-agent配置.png
[root@web01 ~]# systemctl  start zabbix-proxy
[root@web01 ~]# systemctl  enable  zabbix-proxy

2.10 添加hosts解析:

zabbix-server服務(wù)器上添加:
10.0.0.7 web01 sh-porxy

zabbix-proxy(web01)服務(wù)器上添加:
172.16.1.20 web02-jk

2.11 zabbix-server服務(wù)器的web端配置如下:


zabbix監(jiān)控分布式配置1-1.png
zabbix監(jiān)控分布式配置1-2.png
zabbix監(jiān)控分布式配置2-1.png
zabbix監(jiān)控分布式配置2-2.png
zabbix監(jiān)控分布式配置2-3.png
zabbix監(jiān)控分布式配置2-4.png

2.12 檢測(cè)數(shù)據(jù):


zabbix監(jiān)控分布式配置3.png
zabbix監(jiān)控分布式配置4.png
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容