From 5ed6f2c2ce1c551016da89fb25bd57f238ff8a31 Mon Sep 17 00:00:00 2001 From: Piyush Agarwal Date: Tue, 26 Nov 2024 17:31:40 +0530 Subject: [PATCH] ceph-exporter: add support for exporter in docker setup Signed-off-by: Piyush Agarwal --- .env.example | 1 + docker-compose.yml | 1 + docker/ceph/rpm/Dockerfile | 1 + docker/ceph/set-start-env.sh | 5 +++++ docker/prometheus/ceph-exporter-targets.yml | 8 ++++++++ docker/prometheus/prometheus.yml | 9 +++++++++ 6 files changed, 25 insertions(+) create mode 100644 docker/prometheus/ceph-exporter-targets.yml diff --git a/.env.example b/.env.example index 7b1ee91fcd..426b93ad55 100644 --- a/.env.example +++ b/.env.example @@ -49,6 +49,7 @@ DASHBOARD_SSL=1 DASHBOARD_URL= TEST_ORCHESTRATOR=1 RGW_MULTISITE=0 +EXPORTER=1 # set this to a downstream product # note: multiple builds are not supported diff --git a/docker-compose.yml b/docker-compose.yml index 52342c4590..4ce05af20c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -37,6 +37,7 @@ services: - PYTHONDONTWRITEBYTECODE=1 - RGW - RGW_MULTISITE=${RGW_MULTISITE:-0} + - EXPORTER=${EXPORTER:-0} - NVMEOF_GW=${NVMEOF_GW} cap_add: - ALL diff --git a/docker/ceph/rpm/Dockerfile b/docker/ceph/rpm/Dockerfile index 41a187d09a..c3825af0cf 100644 --- a/docker/ceph/rpm/Dockerfile +++ b/docker/ceph/rpm/Dockerfile @@ -13,6 +13,7 @@ ARG CEPH_RELEASE=main COPY rpm/*.* /root/ RUN /root/set-ceph-repo.sh RUN dnf install -y --nogpgcheck ceph-mds ceph-mgr-cephadm ceph-mgr-dashboard \ + ceph-exporter \ ceph-mgr-diskprediction-local \ ceph-mon ceph-osd ceph-radosgw rbd-mirror \ && dnf clean packages diff --git a/docker/ceph/set-start-env.sh b/docker/ceph/set-start-env.sh index 3fd60f6b41..14c5c52630 100755 --- a/docker/ceph/set-start-env.sh +++ b/docker/ceph/set-start-env.sh @@ -26,6 +26,11 @@ fi export RGW_DEBUG export VSTART_OPTIONS +# Add --exporter to VSTART_OPTIONS if the exporter flag is set +if [[ "$EXPORTER" == 1 ]]; then + VSTART_OPTIONS="$VSTART_OPTIONS --cephexporter" +fi + HTTP_PROTO='http' if [[ "$DASHBOARD_SSL" == 1 ]]; then HTTP_PROTO='https' diff --git a/docker/prometheus/ceph-exporter-targets.yml b/docker/prometheus/ceph-exporter-targets.yml new file mode 100644 index 0000000000..075e40f877 --- /dev/null +++ b/docker/prometheus/ceph-exporter-targets.yml @@ -0,0 +1,8 @@ +[ + { + "targets": [ "ceph:9926" ], + "labels": { + cluster: "cluster1" + } + }, +] \ No newline at end of file diff --git a/docker/prometheus/prometheus.yml b/docker/prometheus/prometheus.yml index da51639d7c..a8a1b23b4e 100644 --- a/docker/prometheus/prometheus.yml +++ b/docker/prometheus/prometheus.yml @@ -19,6 +19,15 @@ scrape_configs: - source_labels: [__address__] target_label: cluster replacement: 'cluster1' + - job_name: 'ceph-exporter' + honor_labels: true + file_sd_configs: + - files: + - ceph-exporter-targets.yml + relabel_configs: + - source_labels: [__address__] + target_label: cluster + replacement: 'cluster1' - job_name: 'federate' scrape_interval: 15s honor_labels: true