Centos7.4安装zabbix agent5.0
一、安装步骤
- 关闭防火墙。
systemctl stop firewalld && systemctl disable firewalld
setenforce 0
sudo systemctl status firewalld #查看防火墙状态
- 下载。
wget https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-agent-5.0.0-1.el7.x86_64.rpm
- 安装
rpm -ivh zabbix-agent-5.0.0-1.el7.x86_64.rpm
- 修改配置文件。在/etc/zabbix/zabbix_agentd.conf文件中搜索以Server开头的,将Server=127.0.0.1 修改成 Server=******(server主机ip)。
vim /etc/zabbix/zabbix_agentd.conf
- 启动,并设置开机自启
systemctl start zabbix-agent.service
systemctl enable zabbix-agent.service
二、添加到监控主机
在web界面依次点击:配置-主机-创建主机。
在主机页面填写主机名称、群组、Interfaces,在模板界面添加模板即可。
三、以脚本方式安装
- 先新建脚本文件
vim zabbix_install.sh
- 脚本内容如下(和第一部分对照)
systemctl stop firewalld && systemctl disable firewalld
setenforce 0
wget https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-agent-5.0.0-1.el7.x86_64.rpm
rpm -ivh zabbix-agent-5.0.0-1.el7.x86_64.rpm
sed -i 's/Server=127.0.0.1/Server=81.71.131.32/' /etc/zabbix/zabbix_agentd.conf #将Server=127.0.0.1改成server主机ip
systemctl start zabbix-agent.service
systemctl enable zabbix-agent.service
- 给脚本权限
chmod 700 zabbix_install.sh
- 运行
./zabbix_install.sh
四、可能遇到的错误
- CentOS 7安装zabbix-agent 5.0报错:依赖检测失败:libpcre.so.0()(64bit)/获取GPG密钥失败解决。
参考解决办法:CentOS 7安装zabbix-agent 5.0报错:依赖检测失败