Zabbix安装实录

1. Zabbix 简介

1.1 是啥?

Zabbix是一款能够监控各种网络参数以及服务器健康性和完整性的软件。

1.2 基础架构?

基础架构

2. 安装部署

2.1 环境规划

服务hadoop102hadoop103hadoop104
zabbix-server
zabbix-agent
zabbix-web
MySQL

2.2 准备工作

(1)关闭防火墙

-- 方式1
sudo service iptables stop
sudo chkconfig iptables off


-- 方式2
sudo systemctl stop iptables
sudo systemctl disable iptables

(2) 关闭Selinux

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

(3) 重启服务器

sudo reboot

2.3 安装Yum源

(1) 查看原始zabbix.repo文件

# (1)   查看原始zabbix.repo文件
sudo cat /etc/yum.repos.d/zabbix.repo

内容如下
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=http://repo.zabbix.com/zabbix/4.4/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

[zabbix-debuginfo]
name=Zabbix Official Repository debuginfo - $basearch
baseurl=http://repo.zabbix.com/zabbix/4.4/rhel/7/$basearch/debuginfo/
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
gpgcheck=1

[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1

(2) 执行以下命令完成全局替换

sudo sed -i 's/http:\/\/repo.zabbix.com/https:\/\/mirrors.aliyun.com\/zabbix/g' /etc/yum.repos.d/zabbix.repo

(3) 查看修改之后的zabbix.repo文件

sudo cat /etc/yum.repos.d/zabbix.repo
内容如下
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

[zabbix-debuginfo]
name=Zabbix Official Repository debuginfo - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/$basearch/debuginfo/
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
gpgcheck=1

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

2.4 安装Zabbix

(1)在hadoop102 上安装

[hadoop@hadoop102 ~]$ sudo yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent

(2)在hadoop103 和 hadoop104上安装

[hadoop@hadoop103 ~]$ sudo yum install -y zabbix-agent

[hadoop@hadoop104 ~]$ sudo yum install -y zabbix-agent

2.5 配置Zabbix

2.5.1 创建Zabbix 数据库
[hadoop@hadoop102 ~]$ mysql -uroot -p1230 -e"create database zabbix character set utf8 collate utf8_bin"
2.5.2 初始化Zabbix 数据库
[hadoop@hadoop102 ~]$ zcat /usr/share/doc/zabbix-server-mysql-4.4.10/create.sql.gz | mysql -uroot -p1230 zabbix 
2.5.3 配置Zabbix-Server

(1) 修改zabbix_server.conf配置文件

sudo vim /etc/zabbix/zabbix_server.conf
sudo vim /etc/zabbix/zabbix_server.conf
2.5.4 配置Zabbix-Agent

(1) zabbix_agent文件

[hadoop@hadoop102 ~]$ sudo vim /etc/zabbix/zabbix_agentd.conf
[hadoop@hadoop103 ~]$ sudo vim /etc/zabbix/zabbix_agentd.conf
[hadoop@hadoop104 ~]$ sudo vim /etc/zabbix/zabbix_agentd.conf
Server=hadoop102
#ServerActive=127.0.0.1
#Hostname=Zabbix server
2.5.5 配置Zabbix_Web 时区
[hadoop@hadoop102 ~]$ sudo vim /etc/httpd/conf.d/zabbix.conf
        # php_value date.timezone Europe/Riga
        php_value date.timezone Asia/Shanghai
2.5.6 启动Zabbix
[hadoop@hadoop102 ~]$ sudo systemctl start zabbix-server zabbix-agent httpd
[hadoop@hadoop102 ~]$ sudo systemctl enable zabbix-server zabbix-agent httpd

[hadoop@hadoop103 ~]$ sudo systemctl start zabbix-agent
[hadoop@hadoop103 ~]$ sudo systemctl enable zabbix-agent

[hadoop@hadoop104 ~]$ sudo systemctl start zabbix-agent
[hadoop@hadoop104 ~]$ sudo systemctl enable zabbix-agent
2.5.7 配置Zabbix_Web的数据库

1)浏览器访问http://hadoop102/zabbix
在这里插入图片描述

2)检查配置
在这里插入图片描述

3)配置数据库
在这里插入图片描述

4)配置zabbix-server
在这里插入图片描述

5)再次确认配置
在这里插入图片描述

5)点击完成
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值