]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
exporter: add ceph-exporter package
authorAvan Thakkar <athakkar@redhat.com>
Thu, 24 Mar 2022 08:51:56 +0000 (14:21 +0530)
committerAvan Thakkar <athakkar@redhat.com>
Mon, 20 Jun 2022 18:20:46 +0000 (23:50 +0530)
Signed-off-by: Avan Thakkar <athakkar@redhat.com>
ceph.spec.in
src/exporter/CMakeLists.txt
src/exporter/DaemonMetricCollector.cc

index 718731c88e9e8788bd195873c5abb928df021cf0..35691c4460566ae833a38533ef1f7c274d42f211 100644 (file)
@@ -722,6 +722,15 @@ Requires:  libcephfs2 = %{_epoch_prefix}%{version}-%{release}
 %description -n cephfs-mirror
 Daemon for mirroring CephFS snapshots between Ceph clusters.
 
+%package -n ceph-exporter
+Summary:       Ceph daemon for collecting perf counters
+%if 0%{?suse_version}
+Group:         System/Filesystems
+%endif
+Requires:      ceph-base = %{_epoch_prefix}%{version}-%{release}
+%description -n ceph-exporter
+Daemon for collecting perf counters.
+
 %package -n rbd-fuse
 Summary:       Ceph fuse-based client
 %if 0%{?suse_version}
@@ -1975,6 +1984,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*
index ba062954888b7f3767931160da7f94d63d53ce1d..01f3ab4d8743c1b2b83a47fba60c604743354593 100644 (file)
@@ -6,3 +6,4 @@ set(exporter_srcs
 add_executable(ceph-exporter ${exporter_srcs})
 target_link_libraries(ceph-exporter
   global-static ceph-common)
+install(TARGETS ceph-exporter DESTINATION bin)
index c50b0ed51985bb8d9b3124a62c85e76b6a33dd22..fa88834198b932ad5f7ecc249fb5323d54b71945 100644 (file)
@@ -137,15 +137,17 @@ void DaemonMetricCollector::send_requests() {
 }
 
 void DaemonMetricCollector::update_sockets() {
-  std::string path = "/tmp/ceph-asok.Qq4nS2";
+  std::string path = "/var/run/ceph/";
   for (const auto & entry : std::filesystem::directory_iterator(path)) {
-    std::string daemon_socket_name = entry.path().filename().string();
-    std::cout << "Got socket: " << daemon_socket_name << std::endl;
-    // remove .asok
-    std::string daemon_name = daemon_socket_name.substr(0, daemon_socket_name.size() - 5);
-    if (clients.find(daemon_name) == clients.end()) {
-      AdminSocketClient sock(entry.path().string());
-      clients.insert({daemon_name, std::move(sock)});
+    if (entry.path().extension() == ".asok") {
+      std::string daemon_socket_name = entry.path().filename().string();
+      std::cout << "Got socket: " << daemon_socket_name << std::endl;
+      // remove .asok
+      std::string daemon_name = daemon_socket_name.substr(0, daemon_socket_name.size() - 5);
+      if (clients.find(daemon_name) == clients.end()) {
+        AdminSocketClient sock(entry.path().string());
+        clients.insert({daemon_name, std::move(sock)});
+      }
     }
   }
 }