Zabbix Agent for Linux CentOS7部署

一、环境介绍
在这里插入图片描述
二、Zabbix_Agent安装
1、将Zabbix_Agent程序拷贝至4.25.12.101服务器的/usr/src/zabbix-agent4.2/目录下(可以使用XFTP工具上传)

[root@Node3 zabbix3.4.5]# scp zabbix-agent-4.2.1-1.el7.x86_64.rpm  root@node1:/usr/src/zabbix3.4.5
root@node1's password: 
zabbix-agent-4.2.1-1.el7.x86_64.rpm               100%  359KB  29.9MB/s   00:00  

2、通过yum方式安装当前目录下的rpm包

[root@Node1 zabbix3.4.5]# yum install -y zabbix-agent-4.2.1-1.el7.x86_64.rpm    
已加载插件:fastestmirror, langpacks
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
正在检查 zabbix-agent-4.2.1-1.el7.x86_64.rpm: zabbix-agent-4.2.1-1.el7.x86_64
zabbix-agent-4.2.1-1.el7.x86_64.rpm 将被安装
正在解决依赖关系
--> 正在检查事务
---> 软件包 zabbix-agent.x86_64.0.4.2.1-1.el7 将被 安装
--> 解决依赖关系完成
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"
http://mirrors.cqu.edu.cn/CentOS/7.5.1804/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.cqu.edu.cn; 未知的错误"
正在尝试其它镜像。
http://mirror.lzu.edu.cn/centos/7.5.1804/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.lzu.edu.cn; 未知的错误"
正在尝试其它镜像。
http://mirrors.njupt.edu.cn/centos/7.5.1804/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.njupt.edu.cn; 未知的错误"
正在尝试其它镜像。
http://mirrors.neusoft.edu.cn/centos/7.5.1804/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.neusoft.edu.cn; 未知的错误"
正在尝试其它镜像。
http://mirrors.nju.edu.cn/centos/7.5.1804/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.nju.edu.cn; 未知的错误"
正在尝试其它镜像。
http://mirrors.zju.edu.cn/centos/7.5.1804/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.zju.edu.cn; 未知的错误"
正在尝试其它镜像。
http://mirrors.163.com/centos/7.5.1804/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.163.com; 未知的错误"
正在尝试其它镜像。
http://mirror.bit.edu.cn/centos/7.5.1804/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.bit.edu.cn; 未知的错误"
正在尝试其它镜像。
http://mirrors.huaweicloud.com/centos/7.5.1804/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.huaweicloud.com; 未知的错误"
正在尝试其它镜像。
http://mirrors.shu.edu.cn/centos/7.5.1804/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.shu.edu.cn; 未知的错误"
正在尝试其它镜像。
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"
http://mirrors.tuna.tsinghua.edu.cn/centos/7.5.1804/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.tuna.tsinghua.edu.cn; 未知的错误"
正在尝试其它镜像。
http://centos.ustc.edu.cn/centos/7.5.1804/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: centos.ustc.edu.cn; 未知的错误"
正在尝试其它镜像。
http://mirrors.cn99.com/centos/7.5.1804/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.cn99.com; 未知的错误"
正在尝试其它镜像。
http://mirrors.aliyun.com/centos/7.5.1804/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.aliyun.com; 未知的错误"
正在尝试其它镜像。
http://mirror.lzu.edu.cn/centos/7.5.1804/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.lzu.edu.cn; 未知的错误"
正在尝试其它镜像。
http://mirrors.neusoft.edu.cn/centos/7.5.1804/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.neusoft.edu.cn; 未知的错误"
正在尝试其它镜像。
http://mirrors.nju.edu.cn/centos/7.5.1804/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.nju.edu.cn; 未知的错误"
正在尝试其它镜像。
http://mirrors.163.com/centos/7.5.1804/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.163.com; 未知的错误"
正在尝试其它镜像。
http://mirrors.huaweicloud.com/centos/7.5.1804/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.huaweicloud.com; 未知的错误"
正在尝试其它镜像。
http://mirrors.shu.edu.cn/centos/7.5.1804/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.shu.edu.cn; 未知的错误"
正在尝试其它镜像。
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"
http://mirrors.cqu.edu.cn/CentOS/7.5.1804/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.cqu.edu.cn; 未知的错误"
正在尝试其它镜像。
http://ftp.sjtu.edu.cn/centos/7.5.1804/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: ftp.sjtu.edu.cn; 未知的错误"
正在尝试其它镜像。
http://mirror.lzu.edu.cn/centos/7.5.1804/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.lzu.edu.cn; 未知的错误"
正在尝试其它镜像。
http://mirrors.zju.edu.cn/centos/7.5.1804/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.zju.edu.cn; 未知的错误"
正在尝试其它镜像。
http://mirror.bit.edu.cn/centos/7.5.1804/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.bit.edu.cn; 未知的错误"
正在尝试其它镜像。
http://mirrors.cn99.com/centos/7.5.1804/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.cn99.com; 未知的错误"
正在尝试其它镜像。
http://mirrors.aliyun.com/centos/7.5.1804/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.aliyun.com; 未知的错误"
正在尝试其它镜像。
http://mirrors.neusoft.edu.cn/centos/7.5.1804/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.neusoft.edu.cn; 未知的错误"
正在尝试其它镜像。
http://mirrors.huaweicloud.com/centos/7.5.1804/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.huaweicloud.com; 未知的错误"
正在尝试其它镜像。
http://mirrors.shu.edu.cn/centos/7.5.1804/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.shu.edu.cn; 未知的错误"
正在尝试其它镜像。

依赖关系解决

===================================================================================================================================================================================================
 Package                                    架构                                 版本                                         源                                                              大小
===================================================================================================================================================================================================
正在安装:
 zabbix-agent                               x86_64                               4.2.1-1.el7                                  /zabbix-agent-4.2.1-1.el7.x86_64                               1.6 M

事务概要
===================================================================================================================================================================================================
安装  1 软件包

总计:1.6 M
安装大小:1.6 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 数据库已被非 yum 程序修改。
** 发现 16 个已存在的 RPM 数据库问题, 'yum check' 输出如下:
e2fsprogs-1.42.9-12.el7_5.x86_64 是 e2fsprogs-1.42.9-7.el7.x86_64 的副本
e2fsprogs-libs-1.42.9-12.el7_5.x86_64 是 e2fsprogs-libs-1.42.9-7.el7.x86_64 的副本
krb5-libs-1.15.1-19.el7.x86_64 是 krb5-libs-1.13.2-10.el7.x86_64 的副本
libcom_err-1.42.9-12.el7_5.x86_64 是 libcom_err-1.42.9-7.el7.x86_64 的副本
libselinux-2.5-12.el7.x86_64 有已安装冲突 systemd < ('0', '219', '20'): systemd-219-19.el7.x86_64
libselinux-2.5-12.el7.x86_64 是 libselinux-2.2.2-6.el7.x86_64 的副本
libselinux-python-2.5-12.el7.x86_64 是 libselinux-python-2.2.2-6.el7.x86_64 的副本
libselinux-utils-2.5-12.el7.x86_64 是 libselinux-utils-2.2.2-6.el7.x86_64 的副本
libsepol-2.5-8.1.el7.x86_64 是 libsepol-2.1.9-3.el7.x86_64 的副本
libss-1.42.9-12.el7_5.x86_64 是 libss-1.42.9-7.el7.x86_64 的副本
ncurses-devel-5.9-14.20130511.el7_4.x86_64 有缺少的需求 ncurses-libs(x86-64) = ('0', '5.9', '14.20130511.el7_4')
1:openssl-1.0.2k-12.el7.x86_64 是 1:openssl-1.0.1e-42.el7.9.x86_64 的副本
1:openssl-libs-1.0.2k-12.el7.x86_64 是 1:openssl-libs-1.0.1e-42.el7.9.x86_64 的副本
pcre-devel-8.32-17.el7.x86_64 有缺少的需求 pcre(x86-64) = ('0', '8.32', '17.el7')
readline-devel-6.2-10.el7.x86_64 有缺少的需求 readline = ('0', '6.2', '10.el7')
zlib-1.2.7-17.el7.x86_64 是 zlib-1.2.7-15.el7.x86_64 的副本
  正在安装    : zabbix-agent-4.2.1-1.el7.x86_64                                                                                                                                                1/1 
  验证中      : zabbix-agent-4.2.1-1.el7.x86_64                                                                                                                                                1/1 

已安装:
  zabbix-agent.x86_64 0:4.2.1-1.el7                                                                                                                                                                

完毕!

3、修改/etc/zabbix/zabbix_agentd.conf配置文件

[root@Node1 ~]# vim /etc/zabbix/zabbix_agentd.conf
[root@Node1 ~]# grep -n "^[a-Z]" /etc/zabbix/zabbix_agentd.conf
13:PidFile=/var/run/zabbix/zabbix_agentd.pid
32:LogFile=/var/log/zabbix/zabbix_agentd.log
43:LogFileSize=0
57:DebugLevel=3                         //日志级别,默认为3
97:Server=4.25.12.103                 //用于被动模式,数据获取
138:ServerActive=4.25.12.103          //用于主动模式,数据提交
149:Hostname=4.25.12.101_server          //必须与创建主机时的hostname一致
267:Include=/etc/zabbix/zabbix_agentd.d/*.conf  //包含子配置文件的路径
286:UnsafeUserParameters=1                    //允许所有字符的参数传递给用户定义的参数,默认为0,即没有启用

4、启动zabbix_agent服务器,并设置开机自启动

[root@Node1 ~]# systemctl start zabbix-agent.service 
[root@Node1 ~]# systemctl enable zabbix-agent.service      
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
[root@Node1 ~]# ss -tnl | grep 100
LISTEN     0      100    127.0.0.1:25                       *:*                  
LISTEN     0      128          *:10050                    *:*                  
LISTEN     0      100        ::1:25                      :::*                  
LISTEN     0      128         :::10050                   :::* 

三、Zabbix Server上添加主机
1、点击配置–>主机–>主机,按照下图红框填写信息,然后点击模板,进行下一步操作

在这里插入图片描述
2、点击模板之后,进行模板关联,点击添加
在这里插入图片描述

3、然后看到以下界面,说明模板已经关联,发现ZBX为绿色,代表正常:

在这里插入图片描述

4、在Web界面查看可用内存如下:

在这里插入图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值