zabbix.sh 939 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. cd
  14. wget -P /tmp/ http://repo.zabbix.com/zabbix/3.4/debian/pool/main/z/zabbix-release/zabbix-release_3.4-1+stretch_all.deb
  15. dpkg -i /tmp/zabbix-release_3.4-1+stretch_all.deb
  16. apt-get update -y
  17. apt-get install zabbix-agent -y
  18. # configure
  19. echo -n "Please provide the zabbix-server's ip : "
  20. read _ip
  21. echo -n "Please provide the hostname of this agent : "
  22. read _host_name
  23. sed -i 's#Server=127.0.0.1#Server=$_ip#g' /etc/zabbix/zabbix-agent.confd
  24. sed -i 's#Hostname=Zabbix server#Hostname=$_host_name#g'
  25. systemctl restart zabbix-agent
  26. systemctl enable zabbix-agent
  27. echo -e "\033[92;1mZabbix-agent installed and configured, please add the host in your zabbix-server \033[Om"