当前位置:网站首页>集群监控——Zabbix
集群监控——Zabbix
2022-08-04 12:00:00 【丝丝呀】
1 Zabbix部署
集群规划

1.1 准备工作
关闭集群
如果集群开启,先关闭集群。因为安装Zabbix前,需要重启虚拟机。
[[email protected] ~]$ cluster.sh stop
关闭防火墙(3台节点,已关闭)
[[email protected] ~]$ sudo service iptables stop
[[email protected] ~]$ sudo chkconfig iptables off
[[email protected] ~]$ sudo service iptables stop
[[email protected] ~]$ sudo chkconfig iptables off
[[email protected] ~]$ sudo service iptables stop
[[email protected] ~]$ sudo chkconfig iptables off
闭SELinux(hadoop102)
1)修改配置文件/etc/selinux/config
[[email protected] ~]$ sudo vim /etc/selinux/config
修改如下内容
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted

2)重启服务器
[[email protected] ~]$ sudo reboot
1.2 配置Zabbix yum源
安装yum仓库
1)安装zabbix的yum仓库
[[email protected]hadoop102 ~]$ sudo rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm

[[email protected]hadoop103 ~]$ sudo rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
[[email protected]hadoop104 ~]$ sudo rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
2)安装Software Collections仓库
[[email protected]hadoop102 ~]$ sudo yum install -y centos-release-scl

[[email protected]hadoop103 ~]$ sudo yum install -y centos-release-scl
[[email protected]hadoop104 ~]$ sudo yum install -y centos-release-scl
安装完仓库,出现这三个文件

修改zabbix仓库配置文件
执行以下命令完成全局替换,三台都替换
[[email protected] ~]$ sudo sed -i 's/http:\/\/repo.zabbix.com/https:\/\/mirrors.aliyun.com\/zabbix/g' /etc/yum.repos.d/zabbix.repo
启用zabbix-web仓库
打开/etc/yum.repos.d/zabbix.repo文件
[[email protected] yum.repos.d]$ vim zabbix.repo

2 安装Zabbix
在hadoop102、hadoop103、hadoop104三台节点分别执行以下安装命令
[[email protected]hadoop102 ~]$ sudo yum install -y zabbix-server-mysql zabbix-agent zabbix-web-mysql-scl zabbix-apache-conf-scl
[[email protected]hadoop103 ~]$ sudo yum install -y zabbix-agent
[[email protected]hadoop104 ~]$ sudo yum install -y zabbix-agent
3 配置Zabbix
1)创建zabbix数据库
[[email protected]hadoop102 ~]$ mysql -uroot -p000000 -e"create database zabbix character set utf8 collate utf8_bin"

2)导入Zabbix建表语句
[[email protected]hadoop102 ~]$ zcat /usr/share/doc/zabbix-server-mysql-5.0.*/create.sql.gz | mysql -uroot -p000000 zabbix

查看一下


3)配置Zabbix_Server(hadoop102)
修改zabbix-server配置文件
[[email protected] ~]$ sudo vim /etc/zabbix/zabbix_server.conf
DBHost=hadoop102
DBName=zabbix
DBUser=root
DBPassword=000000

4) 配置Zabbix_Agent(三台节点)
修改zabbix-agent配置文件
[[email protected] ~]$ sudo vim /etc/zabbix/zabbix_agentd.conf
修改如下内容:
Server=hadoop102
#ServerActive=127.0.0.1
#Hostname=Zabbix server





5)配置Zabbix_Web时区
修改/etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf文件
[[email protected] ~]$ sudo vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
php_value[date.timezone] = Asia/Shanghai

4 启动停止Zabbix
4.1 启动Zabbix
[[email protected]hadoop102 ~]$ sudo systemctl start zabbix-server zabbix-agent httpd rh-php72-php-fpm
查看一下状态
[[email protected] ~]$ sudo systemctl status zabbix-server zabbix-agent httpd rh-php72-php-fpm

设置开机自启
[[email protected]hadoop102 ~]$ sudo systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
[[email protected]hadoop103 ~]$ sudo systemctl start zabbix-agent
[[email protected]hadoop103 ~]$ sudo systemctl enable zabbix-agent
[[email protected]hadoop104 ~]$ sudo systemctl start zabbix-agent
[[email protected]hadoop104 ~]$ sudo systemctl enable zabbix-agent
4.2 停止Zabbix
[[email protected]hadoop102 ~]$ sudo systemctl stop zabbix-server zabbix-agent httpd rh-php72-php-fpm
[[email protected]hadoop102 ~]$ sudo systemctl disable zabbix-server zabbix-agent httpd rh-php72-php-fpm
[[email protected]hadoop103 ~]$ sudo systemctl stop zabbix-agent
[[email protected]hadoop103 ~]$ sudo systemctl disable zabbix-agent
[[email protected]hadoop104 ~]$ sudo systemctl stop zabbix-agent
[[email protected]hadoop104 ~]$ sudo systemctl disable zabbix-agent
4.3 连接Zabbix_Web数据库
1)浏览器访问http://hadoop102/zabbix/

2)检查配置

3)配置数据库

4)配置zabbix-server


4.4 登录Zabbix
1)用户名密码如下
用户名:Admin 密码:zabbix

2)点击User Settings,语言设成中文


边栏推荐
猜你喜欢

ECCV 2022 | 通往数据高效的Transformer目标检测器

244 page PDF!"2022 China cloud computing ecological blue book published

高速电路PCB布局布线参考

活动报名:如何高效应对当下的实时场景需求?

多表查询

手搓一个“七夕限定”,用3D Engine 5分钟实现烟花绽放效果

#夏日挑战赛#OpenHarmony 给你的输入法加点彩—星球崛起

shell之循环语句(for、while、until)

数据库表列类型;DML_添加数据;DDL_修改,删除数据库表

LeetCode每日一题(858. Mirror Reflection)
随机推荐
yolo系列的Neck模块
博云入选 Gartner 中国 DevOps 代表厂商
手搓一个“七夕限定”,用3D Engine 5分钟实现烟花绽放效果
backbone核心详解系列——RepVGG
Transferring Rich Feature Hierarchies for Robust
编辑器vscode Already included file name ‘xxx‘ differs from file name ‘xxx‘ only in casing报错
Leetcode brush questions - 543. Diameter of binary trees, 617. Merging binary trees (recursive solution)
shell之循环语句(for、while、until)
什么是 DevOps?看这一篇就够了!
如何用一条命令将网页转成电脑 App
MTBF是什么意思?交换机做MTBF有什么要求?MTTF、MTBF和MTTR的区别是什么?
炫酷又高效的数据可视化大屏,做起来真的没那么难!丨极客星球
深度学习------戴口罩和不戴口罩
多表查询
外键约束;外键约束
开发小程序插件如何实现盈利?
matlab串口读写
移动跨端技术方案分析对比
聪明的儿子处理婆媳关系的方法(处理婆媳关系的方法)
POJ3687Labeling Balls题解