Zabbix部署agent2
创始人
2024-03-27 06:57:09
0

客户端提前部署好

下载rpm环境
http://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-agent2-5.0.2-1.el7.x86_64.rpm安装
[root@vpn_server opt]# yum localinstall zabbix-agent2-5.0.2-1.el7.x86_64.rpm -y# 修改配置⽂件,启动zabbix-agent2
# 在zabbix-server服务端验证[root@zabbix-server01 ~]# zabbix_get -s 192.168.227.69 -p 10050 -k 'agent.ping'
1

部署agent2

yum安装

准备⼀台linux虚拟机,且配置好专有的yum源

# 信息
192.168.227.151
zbz-agent01
# yum源配置,防⽕墙关闭# 注意时间正确
yum install ntpdate -y
ntpdate -u ntp.aliyun.commv /etc/localtime{,.bak}
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime[root@localhost ~]# ll /etc/ | grep localtime
lrwxrwxrwx.  1 root root     33 Nov 28 15:24 localtime -> /usr/share/zoneinfo/Asia/Shanghai
lrwxrwxrwx.  1 root root     35 Sep 21 22:13 localtime.bak -> ../usr/share/zoneinfo/Asia/Shanghai
[root@localhost ~]#

配置镜像源

[root@localhost ~]# rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
Retrieving https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
warning: /var/tmp/rpm-tmp.y4h7xr: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...1:zabbix-release-5.0-1.el7         ################################# [100%]
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' /etc/yum.repos.d/zabbix.repo
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base extras updates zabbix zabbix-non-supported
Cleaning up list of fastest mirrors
[root@localhost ~]# 

安装步骤

1.安装agent2
yum install zabbix-agent2 -y2.配置⽂件了解
默认配置⽂件为 /etc/zabbix/zabbix_agent2.conf默认⼆进制⽂件为 /usr/sbin/zabbix_agent23.启动agent2且开机⾃启
systemctl enable --now zabbix-agent24.检查端⼝
[root@zbz-agent01 ~]# netstat -tunlp|grep zabbix5.查看systemctl管理的单元⽂件
[root@zbz-agent01 ~]# cat /lib/systemd/system/zabbix-agent2.service

在这里插入图片描述

修改agent2配置⽂件,修改如下,填写zabbix-server主机ip和主机名

[root@Zabbix-agent02 ~]# grep -Ev '^#|^$' /etc/zabbix/zabbix_agent2.conf
PidFile=/var/run/zabbix/zabbix_agent2.pid
LogFile=/var/log/zabbix/zabbix_agent2.log
LogFileSize=0
Server=192.168.227.150
ServerActive=192.168.227.150
Hostname=Zabbix-agent02
Include=/etc/zabbix/zabbix_agent2.d/*.conf
ControlSocket=/tmp/agent.sock

Server 和 ServerActive 配置为 zabibx server 或 zabbix proxy 地址,Hostname 配置为主机名即可。

Agent2 没有组件依赖,可直接拷⻉编译好的⼆进制⽂件和配置⽂件在其他主机上运⾏即可。

改了配置⽂件,注意重启agent2

systemctl restart zabbix-agent2 

在这里插入图片描述

检测 server-client连通性

在zabbix-server主机上面测试

yum install zabbix-get -y[root@localhost data]# zabbix_get -s '192.168.227.151' -p 10050 -k "agent.ping"
1
[root@localhost data]# zabbix_get -s '192.168.227.151' -p 10050 -k "system.hostname"
Zabbix-agent02

配置SNMP

在这里插入图片描述

在这里插入图片描述

其他

Zabbix 5.0 版本推出了使⽤ go 语⾔重写的 Agent2,也是 5.0 版本新特性,
Agent2 有如下特性:

完成的插件框架⽀持,可扩张服务及应⽤监控
⽀持灵活的采集周期调度
更⾼效的数据采集及传输
可完全替换先有的 agent

解决 zabbix中文乱码问题

⼩⽩框表示乱码含义,是因为我们改了zabbix的语⾔为中⽂
服务器需要安装字体

在这里插入图片描述

yum -y install wqy-microhei-fontscp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf

在这里插入图片描述

此时zabbix已然正确展示中⽂数据

在这里插入图片描述

相关内容

热门资讯

监控摄像头接入GB28181平... 流程简介将监控摄像头的视频在网站和APP中直播,要解决的几个问题是:1&...
Windows10添加群晖磁盘... 在使用群晖NAS时,我们需要通过本地映射的方式把NAS映射成本地的一块磁盘使用。 通过...
protocol buffer... 目录 目录 什么是protocol buffer 1.protobuf 1.1安装  1.2使用...
在Word、WPS中插入AxM... 引言 我最近需要写一些文章,在排版时发现AxMath插入的公式竟然会导致行间距异常&#...
Fluent中创建监测点 1 概述某些仿真问题,需要创建监测点,用于获取空间定点的数据࿰...
educoder数据结构与算法...                                                   ...
MySQL下载和安装(Wind... 前言:刚换了一台电脑,里面所有东西都需要重新配置,习惯了所...
MFC文件操作  MFC提供了一个文件操作的基类CFile,这个类提供了一个没有缓存的二进制格式的磁盘...
有效的括号 一、题目 给定一个只包括 '(',')','{','}'...
【Ctfer训练计划】——(三... 作者名:Demo不是emo  主页面链接:主页传送门 创作初心ÿ...