influxdb-install.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. fi
  39. $STD systemctl enable --now influxdb
  40. msg_ok "Installed InfluxDB"
  41. read -r -p "Would you like to add Telegraf? <y/N> " prompt
  42. if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
  43. msg_info "Installing Telegraf"
  44. $STD apt-get install -y telegraf
  45. msg_ok "Installed Telegraf"
  46. fi
  47. motd_ssh
  48. root
  49. msg_info "Cleaning up"
  50. $STD apt-get autoremove
  51. $STD apt-get autoclean
  52. msg_ok "Cleaned"