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..d4ffbb418d 100755 --- a/docker/ceph/set-start-env.sh +++ b/docker/ceph/set-start-env.sh @@ -26,6 +26,12 @@ fi export RGW_DEBUG export VSTART_OPTIONS +# Add --exporter to VSTART_OPTIONS if the exporter flag is set +echo "Ceph exporter starting" +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