From d7226fcc454a96b664a7f567b4bf04338ac7ccf2 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 --- 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 136b033b267..ff92857b5e8 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -736,6 +736,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} @@ -1998,6 +2007,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 807386fa6d9..723ed439fd2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -606,6 +606,7 @@ endif(NOT WITH_SYSTEM_ROCKSDB) if(WITH_MGR) add_subdirectory(mgr) + add_subdirectory(exporter) endif() set(librados_config_srcs @@ -903,6 +904,7 @@ add_custom_target(vstart-base DEPENDS ceph-mon ceph-authtool ceph-conf + ceph-exporter monmaptool crushtool rados) @@ -915,6 +917,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 d2104a0dad2..da24c673f6b 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 001fac90287..867fc2efd7e 100644 --- a/src/common/options/build_options.cc +++ b/src/common/options/build_options.cc @@ -18,6 +18,7 @@ std::vector