alpine-grafana.sh 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #!/usr/bin/env bash
  2. source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func)
  3. # Copyright (c) 2021-2023 tteck
  4. # Author: tteck (tteckster)
  5. # License: MIT
  6. # https://github.com/tteck/Proxmox/raw/main/LICENSE
  7. function header_info {
  8. clear
  9. cat <<"EOF"
  10. ______ ____
  11. / ____/________ _/ __/___ _____ ____ _
  12. / / __/ ___/ __ / /_/ __ / __ \/ __ /
  13. / /_/ / / / /_/ / __/ /_/ / / / / /_/ /
  14. \____/_/ \__,_/_/ \__,_/_/ /_/\__,_/
  15. Alpine
  16. EOF
  17. }
  18. header_info
  19. echo -e "Loading..."
  20. APP="Alpine-Grafana"
  21. var_disk="0.5"
  22. var_cpu="1"
  23. var_ram="256"
  24. var_os="alpine"
  25. var_version="3.18"
  26. variables
  27. color
  28. catch_errors
  29. function default_settings() {
  30. CT_TYPE="1"
  31. PW=""
  32. CT_ID=$NEXTID
  33. HN=$NSAPP
  34. DISK_SIZE="$var_disk"
  35. CORE_COUNT="$var_cpu"
  36. RAM_SIZE="$var_ram"
  37. BRG="vmbr0"
  38. NET="dhcp"
  39. GATE=""
  40. DISABLEIP6="no"
  41. MTU=""
  42. SD=""
  43. NS=""
  44. MAC=""
  45. VLAN=""
  46. SSH="no"
  47. VERB="no"
  48. echo_default
  49. }
  50. function update_script() {
  51. if ! apk -e info newt >/dev/null 2>&1; then
  52. apk add -q newt
  53. fi
  54. LXCIP=$(ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1)
  55. while true; do
  56. CHOICE=$(
  57. whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --menu "Select option" 11 58 3 \
  58. "1" "Check for Grafana Updates" \
  59. "2" "Allow 0.0.0.0 for listening" \
  60. "3" "Allow only ${LXCIP} for listening" 3>&2 2>&1 1>&3
  61. )
  62. exit_status=$?
  63. if [ $exit_status == 1 ]; then
  64. clear
  65. exit-script
  66. fi
  67. header_info
  68. case $CHOICE in
  69. 1)
  70. apk update && apk upgrade
  71. exit
  72. ;;
  73. 2)
  74. sed -i -e "s/cfg:server.http_addr=.*/cfg:server.http_addr=0.0.0.0/g" /etc/conf.d/grafana
  75. service grafana restart
  76. exit
  77. ;;
  78. 3)
  79. sed -i -e "s/cfg:server.http_addr=.*/cfg:server.http_addr=$LXCIP/g" /etc/conf.d/grafana
  80. service grafana restart
  81. exit
  82. ;;
  83. esac
  84. done
  85. }
  86. start
  87. build_container
  88. description
  89. msg_ok "Completed Successfully!\n"
  90. echo -e "${APP} should be reachable by going to the following URL.
  91. ${BL}http://${IP}:3000${CL} \n"