-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall_agent.sh
23 lines (17 loc) · 953 Bytes
/
install_agent.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
sudo echo "ubuntu:ubuntu" | chpasswd
sudo echo "root:root" | chpasswd
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y install zabbix-agent
sudo apt-get -y install apache2
sudo sed -i "2s/.*/`ifconfig eth0 | grep "inet addr:"| cut -d: -f2 | awk "{ print $1 }"`/g" "/etc/hosts"
sudo sed -i "s/Bcast/`cat /etc/hostname`/g" "/etc/hosts"
sudo sed -i "3s/.*/192.168.11.61\ monitor/g" "/etc/hosts"
sudo /etc/init.d/networking restart
sudo echo "zabbix ALL=NOPASSWD: ALL" >> /etc/sudoers
sudo sed -i "s/# EnableRemoteCommands=0/EnableRemoteCommands=1/" "/etc/zabbix/zabbix_agentd.conf"
sudo sed -i "s/Server=127.0.0.1/Server=192.168.11.9/" "/etc/zabbix/zabbix_agentd.conf"
sudo sed -i "s/ServerActive=127.0.0.1/ServerActive=192.168.11.9:80/" "/etc/zabbix/zabbix_agentd.conf"
sudo sed -i "s/Hostname=Zabbix server/Hostname=`cat /etc/hostname`/" "/etc/zabbix/zabbix_agentd.conf"
sudo service apache2 restart
sudo service zabbix-agent restart