From 757c460be54a5b32af7017471c51c56fda7ee31e Mon Sep 17 00:00:00 2001 From: mdivecky Date: Tue, 10 Dec 2024 13:00:10 +0100 Subject: [PATCH] Init --- compose.yml | 52 ++++++++++++++++++++++++++++++++ config/blackbox/blackbox.yml | 8 +++++ config/prometheus/prometheus.yml | 24 +++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 compose.yml create mode 100644 config/blackbox/blackbox.yml create mode 100644 config/prometheus/prometheus.yml diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..5f39913 --- /dev/null +++ b/compose.yml @@ -0,0 +1,52 @@ + +services: + blackbox: + image: prom/blackbox-exporter:latest + command: + - --config.file=/etc/blackbox/blackbox.yml + volumes: + - ./config/blackbox:/etc/blackbox + ports: + - 127.0.0.1:9115:9115 + + prometheus: + image: prom/prometheus:latest + user: 1000:1000 + ports: + - 127.0.0.1:9094:9090 + volumes: + - ./config/prometheus:/etc/prometheus + - ./data/prometheus:/prometheus + command: --web.enable-lifecycle --web.enable-remote-write-receiver --config.file=/etc/prometheus/prometheus.yml + restart: unless-stopped + + grafana: + image: grafana/grafana-oss:latest + restart: unless-stopped + user: 1000:1000 + environment: + GF_DATABASE_TYPE: postgres + GF_DATABASE_HOST: grafana_db:5432 + GF_DATABASE_NAME: grafana + GF_DATABASE_USER: grafana + GF_DATABASE_PASSWORD: grafana + GF_DATABASE_SSL_MODE: disable + #GF_SERVER_ROOT_URL: "https://grafana.druit.org/" + depends_on: + - grafana_db + ports: + - 3000:3000 + volumes: + - ./data/grafana:/var/lib/grafana +# - ./config/grafana/provisioning:/etc/grafana/provisioning +# - ./config/grafana/dashboards:/var/lib/grafana/dashboards + + grafana_db: + image: postgres:15 + restart: unless-stopped + environment: + POSTGRES_DB: grafana + POSTGRES_USER: grafana + POSTGRES_PASSWORD: grafana + volumes: + - ./data/grafana-db:/var/lib/postgresql/data \ No newline at end of file diff --git a/config/blackbox/blackbox.yml b/config/blackbox/blackbox.yml new file mode 100644 index 0000000..4f1498c --- /dev/null +++ b/config/blackbox/blackbox.yml @@ -0,0 +1,8 @@ +modules: + http_2xx: + prober: http + timeout: 60s + http: + method: GET + valid_http_versions: ["HTTP/1.1", "HTTP/2.0"] + preferred_ip_protocol: "ip4" \ No newline at end of file diff --git a/config/prometheus/prometheus.yml b/config/prometheus/prometheus.yml new file mode 100644 index 0000000..f88f181 --- /dev/null +++ b/config/prometheus/prometheus.yml @@ -0,0 +1,24 @@ +global: + scrape_interval: 20s + scrape_timeout: 10s + evaluation_interval: 20s + +scrape_configs: + - job_name: 'blackbox/primary' + metrics_path: /probe + scrape_interval: 60s + scrape_timeout: 45s + params: + module: [http_2xx] + http_sd_configs: + - url: https://mdivecky.nolog.page/mon-test/targets.json + refresh_interval: 600s + relabel_configs: + - source_labels: [check_url] + target_label: __address__ + - source_labels: [__address__] + target_label: __param_target + - source_labels: [__param_target] + target_label: instance + - target_label: __address__ + replacement: blackbox:9115 \ No newline at end of file