zabbix.sh 922 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/sh
  2. echo -e '\033[35m
  3. _____ __ __ _
  4. /__ / ____ _/ /_ / /_ (_) __
  5. / / / __ `/ __ \/ __ \/ / |/_/
  6. / /__/ /_/ / /_/ / /_/ / /> <
  7. /____/\__,_/_.___/_.___/_/_/|_|
  8. \033[0m'
  9. if [ "$EUID" -ne 0 ]; then
  10. echo "Please run as root"
  11. exit
  12. fi
  13. wget http://repo.zabbix.com/zabbix/3.4/debian/pool/main/z/zabbix-release/zabbix-release_3.4-1+stretch_all.deb
  14. dpkg -i zabbix-release_3.0-2+stretch_all.deb
  15. apt-get update -y
  16. apt-get install zabbix-agent -y
  17. # configure
  18. echo -n "Please provide the zabbix-server's ip : "
  19. read _ip
  20. echo -n "Please provide the hostname of this agent : "
  21. read _host_name
  22. sed -i 's#Server=127.0.0.1#Server=$_ip#g' /etc/zabbix/zabbix-agent.confd
  23. sed -i 's#Hostname=Zabbix server#Hostname=$_host_name#g'
  24. systemctl restart zabbix-agent
  25. systemctl enable zabbix-agent
  26. echo -e "\033[92;1mZabbix-agent installed and configured, please add the host in your zabbix-server \033[Om"