diff --git a/ct/prometheus-alertmanager.sh b/ct/prometheus-alertmanager.sh index 90858dac..adcd77a4 100755 --- a/ct/prometheus-alertmanager.sh +++ b/ct/prometheus-alertmanager.sh @@ -42,18 +42,17 @@ function update_script() { cd /opt wget -q https://github.com/prometheus/alertmanager/releases/download/v${RELEASE}/alertmanager-${RELEASE}.linux-amd64.tar.gz tar -xf alertmanager-${RELEASE}.linux-amd64.tar.gz - cd alertmanager-${RELEASE}.linux-amd64 - cp -rf alertmanager amtool /usr/local/bin/ + cp -rf alertmanager-${RELEASE}.linux-amd64/alertmanager alertmanager-${RELEASE}.linux-amd64/amtool /usr/local/bin/ rm -rf alertmanager-${RELEASE}.linux-amd64 alertmanager-${RELEASE}.linux-amd64.tar.gz echo "${RELEASE}" >/opt/${APP}_version.txt - msg_ok "Updated ${APP} to ${RELEASE}" + msg_ok "Updated ${APP} to v${RELEASE}" msg_info "Starting ${APP}" systemctl start prometheus-alertmanager msg_ok "Started ${APP}" msg_ok "Updated Successfully" else - msg_ok "No update required. ${APP} is already at ${RELEASE}" + msg_ok "No update required. ${APP} is already at v${RELEASE}" fi exit } diff --git a/ct/prometheus.sh b/ct/prometheus.sh index d03e070b..7e1a7858 100644 --- a/ct/prometheus.sh +++ b/ct/prometheus.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) -# Copyright (c) 2021-2025 tteck +# Copyright (c) 2021-2025 community-scripts ORG # Author: tteck (tteckster) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # Source: https://prometheus.io/ @@ -38,22 +38,21 @@ function update_script() { systemctl stop prometheus msg_ok "Stopped ${APP}" - msg_info "Updating ${APP} to ${RELEASE}" + msg_info "Updating ${APP} to v${RELEASE}" + cd /opt wget -q https://github.com/prometheus/prometheus/releases/download/v${RELEASE}/prometheus-${RELEASE}.linux-amd64.tar.gz tar -xf prometheus-${RELEASE}.linux-amd64.tar.gz - cd prometheus-${RELEASE}.linux-amd64 - cp -rf prometheus promtool /usr/local/bin/ - cd ~ + cp -rf prometheus-${RELEASE}.linux-amd64/prometheus prometheus-${RELEASE}.linux-amd64/promtool /usr/local/bin/ rm -rf prometheus-${RELEASE}.linux-amd64 prometheus-${RELEASE}.linux-amd64.tar.gz echo "${RELEASE}" >/opt/${APP}_version.txt - msg_ok "Updated ${APP} to ${RELEASE}" + msg_ok "Updated ${APP} to v${RELEASE}" msg_info "Starting ${APP}" systemctl start prometheus msg_ok "Started ${APP}" msg_ok "Updated Successfully" else - msg_ok "No update required. ${APP} is already at ${RELEASE}" + msg_ok "No update required. ${APP} is already at v${RELEASE}" fi exit } diff --git a/install/prometheus-install.sh b/install/prometheus-install.sh index 94e0e273..959b1602 100644 --- a/install/prometheus-install.sh +++ b/install/prometheus-install.sh @@ -1,9 +1,9 @@ #!/usr/bin/env bash -# Copyright (c) 2021-2025 tteck +# Copyright (c) 2021-2025 community-scripts ORG # Author: tteck (tteckster) -# License: MIT -# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://prometheus.io/ source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" color @@ -14,9 +14,10 @@ network_check update_os msg_info "Installing Dependencies" -$STD apt-get install -y curl -$STD apt-get install -y sudo -$STD apt-get install -y mc +$STD apt-get install -y \ + curl \ + sudo \ + mc msg_ok "Installed Dependencies" msg_info "Installing Prometheus" @@ -25,14 +26,13 @@ mkdir -p /etc/prometheus mkdir -p /var/lib/prometheus wget -q https://github.com/prometheus/prometheus/releases/download/v${RELEASE}/prometheus-${RELEASE}.linux-amd64.tar.gz tar -xf prometheus-${RELEASE}.linux-amd64.tar.gz -cd prometheus-${RELEASE}.linux-amd64 -mv prometheus promtool /usr/local/bin/ -mv prometheus.yml /etc/prometheus/prometheus.yml +mv prometheus-${RELEASE}.linux-amd64/prometheus prometheus-${RELEASE}.linux-amd64/promtool /usr/local/bin/ +mv prometheus-${RELEASE}.linux-amd64/prometheus.yml /etc/prometheus/prometheus.yml echo "${RELEASE}" >/opt/${APPLICATION}_version.txt msg_ok "Installed Prometheus" msg_info "Creating Service" -service_path="/etc/systemd/system/prometheus.service" +cat </etc/systemd/system/prometheus.service" echo "[Unit] Description=Prometheus Wants=network-online.target @@ -49,7 +49,8 @@ ExecStart=/usr/local/bin/prometheus \ ExecReload=/bin/kill -HUP \$MAINPID [Install] -WantedBy=multi-user.target" >$service_path +WantedBy=multi-user.target" +EOF systemctl enable -q --now prometheus msg_ok "Created Service" @@ -59,5 +60,5 @@ customize msg_info "Cleaning up" $STD apt-get -y autoremove $STD apt-get -y autoclean -rm -rf ../prometheus-${RELEASE}.linux-amd64 ../prometheus-${RELEASE}.linux-amd64.tar.gz +rm -rf prometheus-${RELEASE}.linux-amd64 prometheus-${RELEASE}.linux-amd64.tar.gz msg_ok "Cleaned"