Centos7 系統上zabbix-agent一鍵腳本

特別聲明:此腳本只供本人線上使用,放到此博文方便本身查閱。網友切不可直接複製到本身的線上直接套用,使用前必定要多測試。若有套用使用形成損失,與本博主無關。bash

腳本使用說明:sh file eth0
sh install-zabbix-agent.sh etho
IP1爲zabbix-server端的ip地址 192.168.68.40
$1指腳本外傳的eth0網卡的參數
ide

[root@localhost ~]# cat install-zabbix-agent.sh 
#/bin/bash
IP=$(/sbin/ifconfig $1 |awk 'NR==2{print $0}'|awk '{print $2}')
IP1=192.168.68.40
/usr/bin/wget -P /tmp http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-agent-3.2.1-1.el7.x86_64.rpm
/bin/rpm -ivh /tmp/zabbix-agent-3.2.1-1.el7.x86_64.rpm
systemctl enable zabbix-agent.service
#systemctl start zabbix-agent.service
sed -i "s/Server\=127.0.0.1/Server\=$IP1/g;s/ServerActive\=127.0.0.1/ServerActive\=$IP1/g;s/\# ListenIP\=0.0.0.0/ListenIP=${IP}/g;s/Hostname\=Zabbix server/Hostname\=${IP}/g;s/\# UnsafeUserParameters\=0/UnsafeUserParameters\=1/g" /etc/zabbix/zabbix_agentd.conf
systemctl restart zabbix-agent.service
相關文章
相關標籤/搜索