#! /Bin/bash
Echo "nameserver 8.8.8.8 \ nnameserver 8.8.4.4">/etc/resolv. conf
/Sbin/iptables-F
Chkconfig iptables off
Sed-I '/^ SELinux =/S/enforcing/disabled/'/etc/sysconfig/SELinux
Sed-I '/^ SELinux =/S/enforcing/disabled/'/etc/SELinux/config
Setenforce 0
Yes | CP/usr/share/zoneinfo/Asia/hong_kong/etc/localtime
Yum-y install NTP openssh-clients rsync benchmark CT
Sed-I's/^ server 0.centos.pool.ntp.org iBurst/\ Server stdtime.gov.hk prefer/G'/etc/NTP. conf
Ntpdate stdtime.gov.hk
/Etc/init. d/ntpd start
Chkconfig ntpd on
Read-P "Please input the IP address of zabbix server:" ip
Echo $ IP
Read-P "Please input the password of zabbix server:" Password
Command1 = "rsync-AVU $ IP:/usr/local/etc/zabbix_agentd.conf/usr/local/etc /"
Command2 = "rsync-AVU $ IP:/etc/init. d/zabbix_agentd/etc/init. d /"
Command3 = "rsync-AVU $ IP:/usr/local/sbin/zabbix_agentd/usr/local/sbin /"
CT-c"
Spawn $ command1;
CT {
\ "Are you sure you want to continue connecting (Yes/No )? \ "{Send \" Yes \ r \ "; exp_continue}
\ "$ Ip's password: \" {send \ "$ password \ r \"; exp_continue}
}
Spawn $ command2;
CT {
\ "Are you sure you want to continue connecting (Yes/No )? \ "{Send \" Yes \ r \ "; exp_continue}
\ "$ Ip's password: \" {send \ "$ password \ r \"; exp_continue}
}
Spawn $ command3;
CT {
\ "Are you sure you want to continue connecting (Yes/No )? \ "{Send \" Yes \ r \ "; exp_continue}
\ "$ Ip's password: \" {send \ "$ password \ r \"; exp_continue}
}
"
Sed-I "s/Server = 127.0.0.1/Server =" $ IP "/g"/usr/local/etc/zabbix_agentd.conf
Useradd-S/sbin/nologin-M zabbix
Touch/var/log/zabbix_agentd.log
Chown zabbix. zabbix/var/log/zabbix_agentd.log
/Etc/init. d/zabbix_agentd restart
Chkconfig zabbix_agentd on
This article is from the wemux blog, please be sure to keep this source http://wemux.blog.51cto.com/2848943/1559523
Zabbix agentd install script