mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-02-23 05:01:28 +01:00
Prometheus + Alertmanager: Unify scripts for easier maintenance (#1402)
This commit is contained in:
parent
b7a8d3453a
commit
9a4d35b1f2
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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 <<EOF >/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"
|
||||
|
Loading…
Reference in New Issue
Block a user