zabbix-agent安装配置脚本
#!/bin/bash
Server_ip=192.168.72.160
Agent_ip=192.168.72.161
################ zabbix-agent 安装########################
echo -e "----------开始安装zabbix-agent------------"
systemctl stop firewalld
setenforce 0
############# 下载zabbix包 ####################
rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
############## 安装zabbix ####################
yum install wget vim net-tools zabbix-agent -y
############## 修改配置文件 #######################
echo -e "-------------------------修改配置文件-----------------------------------------"
sed -i 's/# EnableRemoteCommands=0/EnableRemoteCommands=1/' /etc/zabbix/zabbix_agentd.conf
sed -i 's/# LogRemoteCommands=0/LogRemoteCommands=1/' /etc/zabbix/zabbix_agentd.conf
sed -i 's/# Server=127.0.0.1/Server=$Server_ip/' /etc/zabbix/zabbix_agentd.conf
sed -i 's/# ListenIP=127.0.0.1/ListenIP=$Agent_ip/' /etc/zabbix/zabbix_agentd.conf
################ 启动agent 服务 ######################
systemctl start zabbix-agent
ps aux | grep zabbix