From 409358abe2b9f2f437a7ae21d4e4dc7810e74de2 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 1 Apr 2025 16:04:47 +0200 Subject: [PATCH] Alpine Prometheus LXC (#3547) --- ct/alpine-prometheus.sh | 46 ++++++++++++++++++++++++++++ frontend/public/json/prometheus.json | 11 +++++++ install/alpine-prometheus-install.sh | 34 ++++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 ct/alpine-prometheus.sh create mode 100644 install/alpine-prometheus-install.sh diff --git a/ct/alpine-prometheus.sh b/ct/alpine-prometheus.sh new file mode 100644 index 000000000..bb3066edc --- /dev/null +++ b/ct/alpine-prometheus.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://prometheus.io/ + +APP="Alpine-Prometheus" +var_tags="${var_tags:-alpine;monitoring}" +var_cpu="${var_cpu:-1}" +var_ram="${var_ram:-256}" +var_disk="${var_disk:-1}" +var_os="${var_os:-alpine}" +var_version="${var_version:-3.21}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + msg_info "Updating Alpine Packages" + $STD apk update + $STD apk upgrade + msg_ok "Updated Alpine Packages" + + msg_info "Updating Prometheus" + $STD apk upgrade prometheus + msg_ok "Updated Prometheus" + + msg_info "Restarting Prometheus" + $STD rc-service prometheus restart + msg_ok "Restarted Prometheus" + + exit 0 +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:9090${CL}" diff --git a/frontend/public/json/prometheus.json b/frontend/public/json/prometheus.json index f7dba6db8..db7d86676 100644 --- a/frontend/public/json/prometheus.json +++ b/frontend/public/json/prometheus.json @@ -24,6 +24,17 @@ "os": "debian", "version": "12" } + }, + { + "type": "alpine", + "script": "ct/alpine-prometheus.sh", + "resources": { + "cpu": 1, + "ram": 256, + "hdd": 1, + "os": "alpine", + "version": "3.21" + } } ], "default_credentials": { diff --git a/install/alpine-prometheus-install.sh b/install/alpine-prometheus-install.sh new file mode 100644 index 000000000..dec563138 --- /dev/null +++ b/install/alpine-prometheus-install.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://prometheus.io/ + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apk add \ + gpg +msg_ok "Installed Dependencies" + +msg_info "Installing Prometheus" +$STD apk add --no-cache prometheus +msg_ok "Installed Prometheus" + +msg_info "Enabling Prometheus Service" +$STD rc-update add prometheus default +msg_ok "Enabled Prometheus Service" + +msg_info "Starting Prometheus" +$STD service prometheus start +msg_ok "Started Prometheus" + +motd_ssh +customize