#!/usr/bin/env bash set -x DOWNLOAD_URL="https://github.com/prometheus/prometheus/releases/download/v2.52.0/prometheus-2.52.0.linux-amd64.tar.gz" groupadd --system prometheus useradd -s /sbin/nologin --system -g prometheus prometheus mkdir /var/lib/prometheus for i in rules rules.d files_sd do mkdir -p /etc/prometheus/${i} done mkdir -p /tmp/prometheus cd /tmp/prometheus #curl -s https://api.github.com/repos/prometheus/prometheus/releases/latest | grep browser_download_url | grep linux-amd64 | cut -d '"' -f 4 | wget -qi - wget "${DOWNLOAD_URL}" -O "prometheus.tar.gz" tar xvf prometheus.tar.gz cd prometheus*/ mv prometheus promtool /usr/local/bin/ prometheus --version mv prometheus.yml /etc/prometheus/prometheus.yml mv consoles/ console_libraries/ /etc/prometheus/ cd ${HOME} cat >/etc/systemd/system/prometheus.service <