2019-09-27Centos7.2安装zabbix_agents.sh脚本

脚本使用说明:sh file eth0 sh install-zabbix-agent.sh

 ethoIP1为zabbix-server端的ip地址 192.168.68.40

$1指脚本外传的eth0网卡的参数


#/bin/bash

IP=$(/sbin/ifconfig $1 |awk 'NR==2{print $0}'|awk '{print $2}')

IP1=10.1.1.19

/usr/bin/wget -P /home/py http://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-agent-4.2.1-1.el7.x86_64.rpm

/bin/rpm -ivh /home/py/zabbix-agent-4.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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容