2023-03-22 20:48:20 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
2025-01-10 16:54:58 +01:00
|
|
|
# Copyright (c) 2021-2025 community-scripts ORG
|
2023-03-22 20:48:20 -04:00
|
|
|
# Author: tteck (tteckster)
|
2025-01-10 16:54:58 +01:00
|
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
|
|
|
# Source: https://prometheus.io/
|
2023-03-22 20:48:20 -04:00
|
|
|
|
2025-03-24 14:20:56 +01:00
|
|
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
2023-03-22 20:48:20 -04:00
|
|
|
color
|
|
|
|
|
verb_ip6
|
|
|
|
|
catch_errors
|
|
|
|
|
setting_up_container
|
|
|
|
|
network_check
|
|
|
|
|
update_os
|
|
|
|
|
|
2025-08-22 20:19:41 +02:00
|
|
|
fetch_and_deploy_gh_release "prometheus" "prometheus/prometheus" "prebuild" "latest" "/usr/local/bin" "*linux-amd64.tar.gz"
|
|
|
|
|
|
2023-03-22 20:48:20 -04:00
|
|
|
msg_info "Installing Prometheus"
|
|
|
|
|
mkdir -p /etc/prometheus
|
|
|
|
|
mkdir -p /var/lib/prometheus
|
2025-08-22 20:19:41 +02:00
|
|
|
mv /usr/local/bin/prometheus.yml /etc/prometheus/prometheus.yml
|
2023-03-22 20:48:20 -04:00
|
|
|
msg_ok "Installed Prometheus"
|
|
|
|
|
|
|
|
|
|
msg_info "Creating Service"
|
2025-08-22 20:19:41 +02:00
|
|
|
cat <<'EOF' >/etc/systemd/system/prometheus.service
|
2025-01-11 09:55:36 +01:00
|
|
|
[Unit]
|
2023-03-22 20:48:20 -04:00
|
|
|
Description=Prometheus
|
|
|
|
|
Wants=network-online.target
|
|
|
|
|
After=network-online.target
|
|
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
|
User=root
|
|
|
|
|
Restart=always
|
|
|
|
|
Type=simple
|
|
|
|
|
ExecStart=/usr/local/bin/prometheus \
|
|
|
|
|
--config.file=/etc/prometheus/prometheus.yml \
|
|
|
|
|
--storage.tsdb.path=/var/lib/prometheus/ \
|
|
|
|
|
--web.listen-address=0.0.0.0:9090
|
2024-12-31 22:14:41 +09:00
|
|
|
ExecReload=/bin/kill -HUP \$MAINPID
|
2023-03-22 20:48:20 -04:00
|
|
|
|
|
|
|
|
[Install]
|
2025-01-11 09:55:36 +01:00
|
|
|
WantedBy=multi-user.target
|
2025-01-10 16:54:58 +01:00
|
|
|
EOF
|
2024-09-03 10:54:34 -04:00
|
|
|
systemctl enable -q --now prometheus
|
2023-03-22 20:48:20 -04:00
|
|
|
msg_ok "Created Service"
|
|
|
|
|
|
|
|
|
|
motd_ssh
|
2023-05-15 07:39:30 -04:00
|
|
|
customize
|
2023-03-22 20:48:20 -04:00
|
|
|
|
|
|
|
|
msg_info "Cleaning up"
|
2024-06-02 08:00:22 -04:00
|
|
|
$STD apt-get -y autoremove
|
|
|
|
|
$STD apt-get -y autoclean
|
2023-03-22 20:48:20 -04:00
|
|
|
msg_ok "Cleaned"
|