CentOS8上Zabbix_Agent2的安装

1. 关闭防火墙

sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
systemctl disable --now firewalld

2. 同步时间服务器

在CentOS8上,ntpdate同步已经变成了chrony

yum install chrony -y

vi /etc/chrony.conf

第一行
server 192.168.122.55 iburst(zabbix-server的ip)

systemctl restart chronyd
systemctl status chronyd

注意服务器端也要开启一下chronyd才可以,然后可以同步发送一条date命令查看是否成功!

3. 统一时区

mv /etc/localtime{,.bak}
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

4. 添加zabbix源并修改为清华源

rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-1.el8.noarch.rpm

[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/6.0/rhel/8/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/6.0/rhel/8/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1

5. 安装zabbix-agent2

yum install zabbix-agent2 -y

6. 查看命令

[root@com yum.repos.d]# ls -l /usr/sbin/zabbix_agent2
-rwxr-xr-x 1 root root 18680048 Apr  4 22:08 /usr/sbin/zabbix_agent2

7. 启动客户端

[root@com yum.repos.d]# systemctl enable --now zabbix-agent2
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-agent2.service → /usr/lib/systemd/system/zabbix-agent2.service.

8. 配置zabbix-agent2文件

[root@com yum.repos.d]# vi /etc/zabbix/zabbix_agent2.conf
Server=192.168.122.55(Server端IP)
ServerActive=192.168.122.55(Server端IP)
Hostname=com.cnpc.engine(主机的名字)

9. 检查刚刚修改的内容

[root@com yum.repos.d]# 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.122.55
ServerActive=192.168.122.55
Hostname=com.cnpc.engine
Include=/etc/zabbix/zabbix_agent2.d/*.conf
ControlSocket=/tmp/agent.sock
Include=./zabbix_agent2.d/plugins.d/*.conf

10. 重启使配置生效

[root@com yum.repos.d]# systemctl restart zabbix-agent2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值