第1章 Zabbix入门
1.1 Zabbix概述
Zabbix是一款能够监控各种网络参数以及服务器健康性和完整性的软件。Zabbix使用灵活的通知机制,允许用户为几乎任何事件配置基于邮件的告警。这样可以快速反馈服务器的问题。基于已存储的数据,Zabbix提供了出色的报告和数据可视化功能。
1.2 Zabbix 基础架构
第2章 Zabbix部署
2.1 集群规划
进程 |
hadoop102节点 |
hadoop103节点 |
hadoop104节点 |
zabbix-agent |
√ |
√ |
√ |
zabbix-server |
√ |
||
MySQL |
√ |
||
zabbix-web |
√ |
2.2 准备工作
2.2.1 关闭集群
如果集群开启,先关闭集群。因为安装Zabbix前,需要重启虚拟机。
[seven@hadoop102 ~]$ cluster.sh stop
2.2.2 关闭防火墙(3台节点,已关闭)
[seven@hadoop102 ~]$ sudo service iptables stop
[seven@hadoop102 ~]$ sudo chkconfig iptables off
[seven@hadoop103 ~]$ sudo service iptables stop
[seven@hadoop103 ~]$ sudo chkconfig iptables off
[seven@hadoop104 ~]$ sudo service iptables stop
[seven@hadoop104 ~]$ sudo chkconfig iptables off
2.2.3 关闭SELinux(hadoop102)
1)修改配置文件/etc/selinux/config
[seven@hadoop102 ~]$ 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)重启服务器
[seven@hadoop102 ~]$ sudo reboot
2.3 配置Zabbix yum源(3台节点)
2.3.1 安装yum仓库
1)安装zabbix的yum仓库
[seven@hadoop102 ~]$ sudo rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
[seven@hadoop103 ~]$ sudo rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
[seven@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仓库
[seven@hadoop102 ~]$ sudo yum install -y centos-release-scl
[seven@hadoop103 ~]$ sudo yum install -y centos-release-scl
[seven@hadoop104 ~]$ sudo yum install -y centos-release-scl
2.3.2 修改zabbix仓库配置文件
hadoop102、hadoop103、hadoop104三台节点,依次执行如下步骤。
1)修改为阿里云镜像
(1)查看原始zabbix.repo文件
[seven@hadoop102 ~]$ sudo cat /etc/yum.repos.d/zabbix.repo
查看内容如下
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-frontend]
name=Zabbix Official Repository frontend - $basearch
baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/frontend
enabled=0
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/5.0/rhel/7/$basearch/debuginfo/
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591