11#! /usr/bin/env bash
22
3- # Copyright (c) 2021-2025 tteck
3+ # Copyright (c) 2021-2025 community-scripts ORG
44# Author: tteck (tteckster)
5- # License: MIT
6- # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
5+ # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+ # Source: https://prometheus.io/
77
88source /dev/stdin <<< " $FUNCTIONS_FILE_PATH"
99color
@@ -14,9 +14,10 @@ network_check
1414update_os
1515
1616msg_info " Installing Dependencies"
17- $STD apt-get install -y curl
18- $STD apt-get install -y sudo
19- $STD apt-get install -y mc
17+ $STD apt-get install -y \
18+ curl \
19+ sudo \
20+ mc
2021msg_ok " Installed Dependencies"
2122
2223msg_info " Installing Prometheus"
@@ -25,14 +26,13 @@ mkdir -p /etc/prometheus
2526mkdir -p /var/lib/prometheus
2627wget -q https://github.com/prometheus/prometheus/releases/download/v${RELEASE} /prometheus-${RELEASE} .linux-amd64.tar.gz
2728tar -xf prometheus-${RELEASE} .linux-amd64.tar.gz
28- cd prometheus-${RELEASE} .linux-amd64
29- mv prometheus promtool /usr/local/bin/
30- mv prometheus.yml /etc/prometheus/prometheus.yml
29+ mv prometheus-${RELEASE} .linux-amd64/prometheus prometheus-${RELEASE} .linux-amd64/promtool /usr/local/bin/
30+ mv prometheus-${RELEASE} .linux-amd64/prometheus.yml /etc/prometheus/prometheus.yml
3131echo " ${RELEASE} " > /opt/${APPLICATION} _version.txt
3232msg_ok " Installed Prometheus"
3333
3434msg_info " Creating Service"
35- service_path= " /etc/systemd/system/prometheus.service"
35+ cat << EOF > /etc/systemd/system/prometheus.service"
3636echo "[Unit]
3737Description=Prometheus
3838Wants=network-online.target
@@ -49,7 +49,8 @@ ExecStart=/usr/local/bin/prometheus \
4949ExecReload=/bin/kill -HUP \$ MAINPID
5050
5151[Install]
52- WantedBy=multi-user.target" > $service_path
52+ WantedBy=multi-user.target"
53+ EOF
5354systemctl enable -q --now prometheus
5455msg_ok " Created Service"
5556
@@ -59,5 +60,5 @@ customize
5960msg_info " Cleaning up"
6061$STD apt-get -y autoremove
6162$STD apt-get -y autoclean
62- rm -rf ../ prometheus-${RELEASE} .linux-amd64 ../ prometheus-${RELEASE} .linux-amd64.tar.gz
63+ rm -rf prometheus-${RELEASE} .linux-amd64 prometheus-${RELEASE} .linux-amd64.tar.gz
6364msg_ok " Cleaned"
0 commit comments