From bea5b44b6747f523fe20f04f21cf0170aa75817a Mon Sep 17 00:00:00 2001 From: cloudbehl Date: Thu, 19 Oct 2023 19:35:26 +0530 Subject: [PATCH] added Thanos for multi-cluster in dashboard Signed-off-by: cloudbehl --- .env.example | 1 + docker-compose.yml | 31 +++++++++++++++++++ .../provisioning/datasources/prometheus.yml | 7 +++++ docker/prometheus/ceph-targets.yml | 6 ++-- docker/prometheus/prometheus.yml | 3 +- 5 files changed, 45 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index df0eac4f8db..8c524a44d02 100644 --- a/.env.example +++ b/.env.example @@ -23,6 +23,7 @@ PROMETHEUS_ALERTS_DIR=monitoring/ceph-mixin PROMETHEUS_HOST_PORT=9090 #PROMETHEUS_IMAGE= +THANOS_IMAGE=thanosio/thanos:main-2023-10-16-77fac93 NODE_EXPORTER_HOST_PORT=9100 #NODE_EXPORTER_IMAGE= ALERTMANAGER_HOST_PORT=9093 diff --git a/docker-compose.yml b/docker-compose.yml index 9727a603737..1636f5ebc81 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -121,6 +121,37 @@ services: - ./docker/prometheus:/etc/prometheus:Z - ${CEPH_REPO_DIR}/${PROMETHEUS_ALERTS_DIR:-monitoring/ceph-mixin}:/etc/prometheus/alerts:Z + thanos-sidecar: + image: ${THANOS_IMAGE} + container_name: thanos-sidecar + hostname: thanos-sidecar + volumes_from: + - prometheus:rw + command: + - "sidecar" + - "--tsdb.path=/prometheus" + - "--prometheus.url=http://prometheus:9090" + expose: + - 10901 + - 10902 + depends_on: + - prometheus + + thanos-querier: + image: ${THANOS_IMAGE} + container_name: thanos-querier + hostname: thanos-querier + command: + - "query" + - "--store=thanos-sidecar:10901" + expose: + - 10902 + - 10901 + ports: + - "10902:10902" + depends_on: + - thanos-sidecar + node-exporter: image: ${NODE_EXPORTER_IMAGE:-prom/node-exporter:v1.5.0} container_name: node-exporter diff --git a/docker/grafana/provisioning/datasources/prometheus.yml b/docker/grafana/provisioning/datasources/prometheus.yml index 1b52e798ab3..6910e092702 100644 --- a/docker/grafana/provisioning/datasources/prometheus.yml +++ b/docker/grafana/provisioning/datasources/prometheus.yml @@ -11,3 +11,10 @@ datasources: orgId: 1 url: http://prometheus:9090 editable: true + + - name: Thanos + type: prometheus + access: proxy + orgId: 1 + url: http://thanos-querier:10902 + editable: true diff --git a/docker/prometheus/ceph-targets.yml b/docker/prometheus/ceph-targets.yml index c0114b2912f..a60aa4c8e19 100644 --- a/docker/prometheus/ceph-targets.yml +++ b/docker/prometheus/ceph-targets.yml @@ -1,10 +1,12 @@ [ { "targets": [ "ceph:9283" ], - "labels": {} + "labels": { + cluster: "cluster1" + } }, { "targets": [ "ceph2:9283" ], "labels": {} } -] \ No newline at end of file +] diff --git a/docker/prometheus/prometheus.yml b/docker/prometheus/prometheus.yml index 670feca365c..75d0b62f9fb 100644 --- a/docker/prometheus/prometheus.yml +++ b/docker/prometheus/prometheus.yml @@ -1,7 +1,8 @@ global: scrape_interval: 5s evaluation_interval: 5s - + external_labels: + cluster: cluster1 scrape_configs: - job_name: 'node-exporter' file_sd_configs: