百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 技术文章 > 正文

集群监控利器之Zabbix

nanshan 2025-01-10 15:54 14 浏览 0 评论

Zabbix概述

Zabbix是一款能够监控各种网络参数以及服务器健康性和完整性的软件。Zabbix使用灵活的通知机制,允许用户为几乎任何事件配置基于邮件的告警。这样可以快速反馈服务器的问题。基于已存储的数据,Zabbix提供了出色的报告和数据可视化功能。

Zabbix部署

进程

hadoop102节点


hadoop103节点

hadoop104节点

zabbix-agent


zabbix-server




MySQL




zabbix-web




(1)准备工作,关闭集群

如果集群开启,先关闭集群。因为安装完毕Zabbix后,需要重启虚拟机。

[atguigu@hadoop102 ~]$ cluster.sh stop

关闭防火墙(3台节点,已关闭)

[atguigu@hadoop102 ~]$ sudo service iptables stop
[atguigu@hadoop102 ~]$ sudo chkconfig iptables off


[atguigu@hadoop103 ~]$ sudo service iptables stop
[atguigu@hadoop103 ~]$ sudo chkconfig iptables off


[atguigu@hadoop104 ~]$ sudo service iptables stop
[atguigu@hadoop104 ~]$ sudo chkconfig iptables off

(2)关闭防火墙

[atguigu@hadoop102 ~]$ sudo service iptables stop
[atguigu@hadoop102 ~]$ sudo chkconfig iptables off


[atguigu@hadoop103 ~]$ sudo service iptables stop
[atguigu@hadoop103 ~]$ sudo chkconfig iptables off


[atguigu@hadoop104 ~]$ sudo service iptables stop
[atguigu@hadoop104 ~]$ sudo chkconfig iptables of

(3)关闭SELinux

[atguigu@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

(4)重启服务器

[atguigu@hadoop102 ~]$  sudo reboot

配置yum源

(1)从阿里云镜像中下载zabbix安装包,并执行安装命令。

[atguigu@hadoop102 ~]$ sudo rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm


[atguigu@hadoop103 ~]$ sudo rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm


[atguigu@hadoop104 ~]$ sudo rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm

(2)修改阿里云镜像101,102,103三台节点,依次执行以下步骤

[atguigu@hadoop102 ~]$ 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

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

[atguigu@hadoop102 ~]$ sudo sed -i 's/http:\/\/repo.zabbix.com/https:\/\/mirrors.aliyun.com\/zabbix/g' /etc/yum.repos.d/zabbix.repo

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

[atguigu@hadoop102 ~]$ 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

安装Zabbix

(1)在hadoop102、hadoop103、hadoop104三台节点分别执行以下安装命令

[atguigu@hadoop102 ~]$ sudo yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
[atguigu@hadoop103 ~]$ sudo yum install zabbix-agent
[atguigu@hadoop104 ~]$ sudo yum install zabbix-agent

(2)创建Zabbix

[atguigu@hadoop102 ~]$ mysql -uroot -p000000 -e"create database zabbix character set utf8 collate utf8_bin"

(3)导入Zabbix建表语句

[atguigu@hadoop102 ~]$ zcat /usr/share/doc/zabbix-server-mysql-4.4.10/create.sql.gz | mysql -uroot -p000000 zabbix

(4)配置Zabbix_Server(hadoop102)

[atguigu@hadoop102 ~]$ sudo vim /etc/zabbix/zabbix_server.conf
DBHost=hadoop102
DBName=zabbix
DBUser=root
DBPassword=000000

(5)配置Zabbix_Agent(三台节点)

[atguigu@hadoop102 ~]$ sudo vim /etc/zabbix/zabbix_agentd.conf
Server=hadoop102
#ServerActive=127.0.0.1
#Hostname=Zabbix server

(6)配置Zabbix_Web时区

[atguigu@hadoop102 ~]$ sudo vim /etc/httpd/conf.d/zabbix.conf
#
# Zabbix monitoring system php web frontend
#


Alias /zabbix /usr/share/zabbix


<Directory "/usr/share/zabbix">
    Options FollowSymLinks
    AllowOverride None
    Require all granted


    <IfModule mod_php5.c>
        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 max_input_vars 10000
        php_value always_populate_raw_post_data -1
        php_value date.timezone Asia/Shanghai
    </IfModule>
</Directory>

(7)启动zabbix

[atguigu@hadoop102 ~]$ sudo systemctl start zabbix-server zabbix-agent httpd
[atguigu@hadoop102 ~]$ sudo systemctl enable zabbix-server zabbix-agent httpd


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


[atguigu@hadoop104 ~]$ sudo systemctl start zabbix-agent
[atguigu@hadoop104 ~]$ sudo systemctl enable zabbix-agent

(8)停止zabbix

[atguigu@hadoop102 ~]$ sudo systemctl stop zabbix-server zabbix-agent httpd
[atguigu@hadoop102 ~]$ sudo systemctl disable zabbix-server zabbix-agent httpd


[atguigu@hadoop103 ~]$ sudo systemctl stop zabbix-agent
[atguigu@hadoop103 ~]$ sudo systemctl disable zabbix-agent


[atguigu@hadoop104 ~]$ sudo systemctl stop zabbix-agent
[atguigu@hadoop104 ~]$ sudo systemctl disable zabbix-agent

(9)连接zabbix_web数据库。访问http://hadoop102/zabbix

(10)检查配置

(11)配置数据库

(12)配置zabbix-server

(13)登录zabbix,用户名admin,密码zabbix

Zabbix使用

(1)创建主机

(2)配置Host

(3)查看新增Host。重复以上步骤添加103,104

(4)创建监控项

(5)配置监控项

(6)查看配置的监控项

(7)查看监控最新数据

(8)创建触发器

(9)创建动作

申请邮箱

(1)点击管理/报警媒介类型/Email

(2)编辑邮箱

(3)测试email

(4)email绑定邮件收件人

测试

(1)关闭集群中的HDFS,会有如下效果

[atguigu@hadoop102 hadoop-3.1.3]$ sbin/stop-dfs.sh

(2)查看邮件,接收故障信息

(3)查看仪表盘故障信息


大数据技术生态体系

大数据和云计算的关系

大数据项目架构

大数据面试题整合

大数据HBase原理

相关推荐

0722-6.2.0-如何在RedHat7.2使用rpm安装CDH(无CM)

文档编写目的在前面的文档中,介绍了在有CM和无CM两种情况下使用rpm方式安装CDH5.10.0,本文档将介绍如何在无CM的情况下使用rpm方式安装CDH6.2.0,与之前安装C5进行对比。环境介绍:...

ARM64 平台基于 openEuler + iSula 环境部署 Kubernetes

为什么要在arm64平台上部署Kubernetes,而且还是鲲鹏920的架构。说来话长。。。此处省略5000字。介绍下系统信息;o架构:鲲鹏920(Kunpeng920)oOS:ope...

生产环境starrocks 3.1存算一体集群部署

集群规划FE:节点主要负责元数据管理、客户端连接管理、查询计划和查询调度。>3节点。BE:节点负责数据存储和SQL执行。>3节点。CN:无存储功能能的BE。环境准备CPU检查JDK...

在CentOS上添加swap虚拟内存并设置优先级

现如今很多云服务器都会自己配置好虚拟内存,当然也有很多没有配置虚拟内存的,虚拟内存可以让我们的低配服务器使用更多的内存,可以减少很多硬件成本,比如我们运行很多服务的时候,内存常常会满,当配置了虚拟内存...

国产深度(deepin)操作系统优化指南

1.升级内核随着deepin版本的更新,会自动升级系统内核,但是我们依旧可以通过命令行手动升级内核,以获取更好的性能和更多的硬件支持。具体操作:-添加PPAs使用以下命令添加PPAs:```...

postgresql-15.4 多节点主从(读写分离)

1、下载软件[root@TX-CN-PostgreSQL01-252software]#wgethttps://ftp.postgresql.org/pub/source/v15.4/postg...

Docker 容器 Java 服务内存与 GC 优化实施方案

一、设置Docker容器内存限制(生产环境建议)1.查看宿主机可用内存bashfree-h#示例输出(假设宿主机剩余16GB可用内存)#Mem:64G...

虚拟内存设置、解决linux内存不够问题

虚拟内存设置(解决linux内存不够情况)背景介绍  Memory指机器物理内存,读写速度低于CPU一个量级,但是高于磁盘不止一个量级。所以,程序和数据如果在内存的话,会有非常快的读写速度。但是,内存...

Elasticsearch性能调优(5):服务器配置选择

在选择elasticsearch服务器时,要尽可能地选择与当前业务量相匹配的服务器。如果服务器配置太低,则意味着需要更多的节点来满足需求,一个集群的节点太多时会增加集群管理的成本。如果服务器配置太高,...

Es如何落地

一、配置准备节点类型CPU内存硬盘网络机器数操作系统data节点16C64G2000G本地SSD所有es同一可用区3(ecs)Centos7master节点2C8G200G云SSD所有es同一可用区...

针对Linux内存管理知识学习总结

现在的服务器大部分都是运行在Linux上面的,所以,作为一个程序员有必要简单地了解一下系统是如何运行的。对于内存部分需要知道:地址映射内存管理的方式缺页异常先来看一些基本的知识,在进程看来,内存分为内...

MySQL进阶之性能优化

概述MySQL的性能优化,包括了服务器硬件优化、操作系统的优化、MySQL数据库配置优化、数据库表设计的优化、SQL语句优化等5个方面的优化。在进行优化之前,需要先掌握性能分析的思路和方法,找出问题,...

Linux Cgroups(Control Groups)原理

LinuxCgroups(ControlGroups)是内核提供的资源分配、限制和监控机制,通过层级化进程分组实现资源的精细化控制。以下从核心原理、操作示例和版本演进三方面详细分析:一、核心原理与...

linux 常用性能优化参数及理解

1.优化内核相关参数配置文件/etc/sysctl.conf配置方法直接将参数添加进文件每条一行.sysctl-a可以查看默认配置sysctl-p执行并检测是否有错误例如设置错了参数:[roo...

如何在 Linux 中使用 Sysctl 命令?

sysctl是一个用于配置和查询Linux内核参数的命令行工具。它通过与/proc/sys虚拟文件系统交互,允许用户在运行时动态修改内核参数。这些参数控制着系统的各种行为,包括网络设置、文件...

取消回复欢迎 发表评论: