PROMETHEUS_VERSION=3.5.0
BLACKBOX_VERSION=0.27.0
GRAFANA_VERSION=12.1.1wget https://github.com/prometheus/prometheus/releases/latest/download/prometheus-${PROMETHEUS_VERSION}.linux-amd64.tar.gz
tar -xzf prometheus-${PROMETHEUS_VERSION}.linux-amd64.tar.gz
cd prometheus-${PROMETHEUS_VERSION}.linux-amd64
cp ../prometheus.yml .
cp -r ../scrapeconfigs .
cd ..wget https://github.com/prometheus/blackbox_exporter/releases/latest/download/blackbox_exporter-${BLACKBOX_VERSION}.linux-amd64.tar.gz
tar -xzf blackbox_exporter-${BLACKBOX_VERSION}.linux-amd64.tar.gz
cd blackbox_exporter-${BLACKBOX_VERSION}.linux-amd64
cp ../blackbox.yml .
cp ../web.yml .
cd ..wget https://dl.grafana.com/oss/release/grafana-${GRAFANA_VERSION}.linux-amd64.tar.gz
tar -xzf grafana-${GRAFANA_VERSION}.linux-amd64.tar.gz
cd grafana-${GRAFANA_VERSION}
cd ..Das Dashboard-JSON (Blackbox Exporter Dashboard.json) kann in Grafana importiert werden.
Prometheus:
cd prometheus-${PROMETHEUS_VERSION}.linux-amd64
./prometheus --config.file=prometheus.yml &Blackbox Exporter:
cd blackbox_exporter-${BLACKBOX_VERSION}.linux-amd64
./blackbox_exporter --config.file=blackbox.yml --web.config=web.yml &Grafana:
cd grafana-${GRAFANA_VERSION}
./bin/grafana-server web &- Grafana: http://localhost:9090/
- Prometheus: http://localhost:3000/
Mit Docker Compose lassen sich alle Services einfach als Container starten. Die benötigte Konfiguration befindet sich in der Datei docker-compose.yml im Projektverzeichnis.
Starten:
docker compose upDas Dashboard-JSON kann wie gewohnt in Grafana importiert werden.
Um ein sicheres bcrypt-Hash für einen User in der web.yml zu erzeugen, kann das Python-Skript auth.py genutzt werden:
python3 auth.pyDas Skript fragt nach einem Passwort und gibt den bcrypt-Hash aus. Diesen Hash kannst du dann in der web.yml als Passwort eintragen, z.B.:
basic_auth_users:
benutzername: <hier-den-bcrypt-hash-einfügen>Beispiel:
basic_auth_users:
test: $2b$12$...deinHash...Weitere Infos: Siehe offizielle Doku von Prometheus, Blackbox Exporter und Grafana.