From 685bb97332cc3d15843a0af2473822d4cc8c89b8 Mon Sep 17 00:00:00 2001 From: Avan Thakkar Date: Mon, 1 Aug 2022 12:20:53 +0530 Subject: [PATCH] exporter: per node metric exporter Fixes: https://tracker.ceph.com/issues/55046 Signed-off-by: Pere Diaz Bou Signed-off-by: Avan Thakkar (cherry picked from commit d7226fcc454a96b664a7f567b4bf04338ac7ccf2) --- ceph.spec.in | 12 + src/CMakeLists.txt | 3 + src/common/options/CMakeLists.txt | 1 + src/common/options/build_options.cc | 2 + src/common/options/ceph-exporter.yaml.in | 54 ++++ src/common/subsys.h | 1 + src/exporter/CMakeLists.txt | 10 + src/exporter/DaemonMetricCollector.cc | 391 +++++++++++++++++++++++ src/exporter/DaemonMetricCollector.h | 104 ++++++ src/exporter/ceph_exporter.cc | 65 ++++ src/exporter/http_server.cc | 169 ++++++++++ src/exporter/http_server.h | 5 + src/exporter/util.cc | 48 +++ src/exporter/util.h | 22 ++ 14 files changed, 887 insertions(+) create mode 100644 src/common/options/ceph-exporter.yaml.in create mode 100644 src/exporter/CMakeLists.txt create mode 100644 src/exporter/DaemonMetricCollector.cc create mode 100644 src/exporter/DaemonMetricCollector.h create mode 100644 src/exporter/ceph_exporter.cc create mode 100644 src/exporter/http_server.cc create mode 100644 src/exporter/http_server.h create mode 100644 src/exporter/util.cc create mode 100644 src/exporter/util.h diff --git a/ceph.spec.in b/ceph.spec.in index 731bd51ede078..530139d065d05 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -733,6 +733,15 @@ Requires: libcephfs2 = %{_epoch_prefix}%{version}-%{release} %description -n cephfs-mirror Daemon for mirroring CephFS snapshots between Ceph clusters. +%package -n ceph-exporter +Summary: Daemon for exposing perf counters as Prometheus metrics +%if 0%{?suse_version} +Group: System/Filesystems +%endif +Requires: ceph-base = %{_epoch_prefix}%{version}-%{release} +%description -n ceph-exporter +Daemon for exposing perf counters as Prometheus metrics + %package -n rbd-fuse Summary: Ceph fuse-based client %if 0%{?suse_version} @@ -1981,6 +1990,9 @@ if [ $1 -ge 1 ] ; then fi fi +%files -n ceph-exporter +%{_bindir}/ceph-exporter + %files -n rbd-fuse %{_bindir}/rbd-fuse %{_mandir}/man8/rbd-fuse.8* diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 83a90e4ecba6b..c779c8521ff12 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -596,6 +596,7 @@ endif(NOT WITH_SYSTEM_ROCKSDB) if(WITH_MGR) add_subdirectory(mgr) + add_subdirectory(exporter) endif() set(librados_config_srcs @@ -889,6 +890,7 @@ add_custom_target(vstart-base DEPENDS ceph-mon ceph-authtool ceph-conf + ceph-exporter monmaptool crushtool rados) @@ -901,6 +903,7 @@ endif() if (WITH_MGR) add_dependencies(vstart-base ceph-mgr) + add_dependencies(vstart-base ceph-exporter) endif() add_custom_target(vstart DEPENDS vstart-base) diff --git a/src/common/options/CMakeLists.txt b/src/common/options/CMakeLists.txt index d2104a0dad267..da24c673f6b37 100644 --- a/src/common/options/CMakeLists.txt +++ b/src/common/options/CMakeLists.txt @@ -93,6 +93,7 @@ add_options(osd) add_options(rbd) add_options(rbd-mirror) add_options(immutable-object-cache) +add_options(ceph-exporter) # if set to empty string, system default luarocks package location (if exist) will be used set(rgw_luarocks_location "") diff --git a/src/common/options/build_options.cc b/src/common/options/build_options.cc index 001fac90287c0..867fc2efd7e1b 100644 --- a/src/common/options/build_options.cc +++ b/src/common/options/build_options.cc @@ -18,6 +18,7 @@ std::vector