influxdb-install.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/usr/bin/env bash
  2. # Copyright (c) 2021-2023 tteck
  3. # Author: tteck (tteckster)
  4. # License: MIT
  5. # https://github.com/tteck/Proxmox/raw/main/LICENSE
  6. source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
  7. color
  8. verb_ip6
  9. catch_errors
  10. setting_up_container
  11. network_check
  12. update_os
  13. msg_info "Installing Dependencies"
  14. $STD apt-get install -y curl
  15. $STD apt-get install -y sudo
  16. $STD apt-get install -y mc
  17. $STD apt-get install -y lsb-base
  18. $STD apt-get install -y lsb-release
  19. $STD apt-get install -y gnupg2
  20. msg_ok "Installed Dependencies"
  21. msg_info "Setting up InfluxDB Repository"
  22. wget -q https://repos.influxdata.com/influxdata-archive_compat.key
  23. cat influxdata-archive_compat.key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg > /dev/null
  24. sh -c 'echo "deb [signed-by=/etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg] https://repos.influxdata.com/debian stable main" > /etc/apt/sources.list.d/influxdata.list'
  25. msg_ok "Set up InfluxDB Repository"
  26. read -r -p "Which version of InfluxDB to install? (1 or 2) " prompt
  27. if [[ $prompt == "2" ]]; then
  28. INFLUX="2"
  29. else
  30. INFLUX="1"
  31. fi
  32. msg_info "Installing InfluxDB"
  33. $STD apt-get update
  34. if [[ $INFLUX == "2" ]]; then
  35. $STD apt-get install -y influxdb2
  36. else
  37. $STD apt-get install -y influxdb
  38. wget -q https://dl.influxdata.com/chronograf/releases/chronograf_1.10.1_amd64.deb
  39. $STD dpkg -i chronograf_1.10.1_amd64.deb
  40. fi
  41. $STD systemctl enable --now influxdb
  42. msg_ok "Installed InfluxDB"
  43. read -r -p "Would you like to add Telegraf? <y/N> " prompt
  44. if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
  45. msg_info "Installing Telegraf"
  46. $STD apt-get install -y telegraf
  47. msg_ok "Installed Telegraf"
  48. fi
  49. motd_ssh
  50. customize
  51. msg_info "Cleaning up"
  52. $STD apt-get autoremove
  53. $STD apt-get autoclean
  54. msg_ok "Cleaned"