最近用官网给的链接下载的都是3.0.28而且总是失败,最后在http://rpm.pbone.net/里找到zabbix-agent3.0.4的rpm包
最近更新了脚本,使得脚本安装更友好,对安装好后的zabbix相关配置进行显示,如此来确保配置无误
找到官方源的解决办法了,就是在zabbix.repo里面把源改掉,换为清华的源,具体方法在此:关于zabbix遇到的小问题
此更新添加了自动识别Hostname
# !/bin/bash
# author : hobby
# Zabbix_agent3.0.4 one-click installation script
Hostname=`cat /etc/hostname`
sudo rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/7/x86_64/zabbix-agent-3.0.4-1.el7.x86_64.rpm
sudo sed -i.ori 's#Server=127.0.0.1#Server=10.9.8.190#' /etc/zabbix/zabbix_agentd.conf
sudo sed -i.ori 's#ServerActive=127.0.0.1#ServerActive=10.9.8.190:10051#' /etc/zabbix/zabbix_agentd.conf
sudo sed -i.ori 's#Hostname=Zabbix server#Hostname='$Hostname'#' /etc/zabbix/zabbix_agentd.conf
sudo sed -i.ori 's#/etc/zabbix/zabbix_agentd.conf/#/etc/zabbix/zabbix_agentd.conf/*.conf#' /etc/zabbix/zabbix_agentd.conf
sudo sed -i.ori 's/# UnsafeUserParameters=0/UnsafeUserParameters=1/' /etc/zabbix/zabbix_agentd.conf
# Add boot start
sudo sed -i.ori '$a\sudo systemctl start zabbix-agent' /etc/rc.d/rc.local
sudo chmod +x /etc/rc.d/rc.local
sudo sed -i.ori 's/# AllowRoot=0/AllowRoot=1/' /etc/zabbix/zabbix_agentd.conf && cat /etc/zabbix/zabbix_agentd.conf |grep AllowRoot=
systemctl start zabbix-agent && ps aux |grep zabbix
cat /etc/zabbix/zabbix_agentd.conf |grep UnsafeUserParameters=
cat /etc/zabbix/zabbix_agentd.conf |grep Server=
cat /etc/zabbix/zabbix_agentd.conf |grep ServerActive=
cat /etc/zabbix/zabbix_agentd.conf |grep Hostname=