summaryrefslogtreecommitdiffstats
path: root/src/tools/cephfs/top/cephfs-top
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-23 16:45:17 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-23 16:45:44 +0000
commit17d6a993fc17d533460c5f40f3908c708e057c18 (patch)
tree1a3bd93e0ecd74fa02f93a528fe2f87e5314c4b5 /src/tools/cephfs/top/cephfs-top
parentReleasing progress-linux version 18.2.2-0progress7.99u1. (diff)
downloadceph-17d6a993fc17d533460c5f40f3908c708e057c18.tar.xz
ceph-17d6a993fc17d533460c5f40f3908c708e057c18.zip
Merging upstream version 18.2.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/cephfs/top/cephfs-top')
-rwxr-xr-xsrc/tools/cephfs/top/cephfs-top27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/tools/cephfs/top/cephfs-top b/src/tools/cephfs/top/cephfs-top
index b39e815fa..ff02e2dd4 100755
--- a/src/tools/cephfs/top/cephfs-top
+++ b/src/tools/cephfs/top/cephfs-top
@@ -168,8 +168,8 @@ class FSTopBase(object):
return False
return True
- def __build_clients(self, fs):
- fs_meta = self.dump_json.setdefault(fs, {})
+ def __build_clients(self, fs, clients_json):
+ fs_meta = clients_json.setdefault(fs, {})
fs_key = self.stats_json[GLOBAL_METRICS_KEY].get(fs, {})
clients = fs_key.keys()
for client_id in clients:
@@ -249,13 +249,32 @@ class FSTopBase(object):
self.stats_json = self.perf_stats_query()
if fs_name: # --dumpfs
if fs_name in fs_list:
- self.__build_clients(fs_name)
+ self.__build_clients(fs_name, clients_json=self.dump_json)
else:
sys.stdout.write(f"Filesystem {fs_name} not available\n")
return
else: # --dump
+ num_clients = num_mounts = num_kclients = num_libs = 0
+ for fs_name in fs_list:
+ client_metadata = self.stats_json[CLIENT_METADATA_KEY].get(fs_name, {})
+ client_cnt = len(client_metadata)
+ if client_cnt:
+ num_clients = num_clients + client_cnt
+ num_mounts = num_mounts + len(
+ [client for client, metadata in client_metadata.items() if
+ CLIENT_METADATA_MOUNT_POINT_KEY in metadata
+ and metadata[CLIENT_METADATA_MOUNT_POINT_KEY] != 'N/A'])
+ num_kclients = num_kclients + len(
+ [client for client, metadata in client_metadata.items() if
+ "kernel_version" in metadata])
+ num_libs = num_clients - (num_mounts + num_kclients)
+ self.dump_json.update({'date': datetime.now().ctime()})
+ client_count = self.dump_json.setdefault("client_count", {})
+ client_count.update({'total_clients': num_clients, 'fuse': num_mounts,
+ 'kclient': num_kclients, 'libcephfs': num_libs})
+ clients_json = self.dump_json.setdefault("filesystems", {})
for fs in fs_list:
- self.__build_clients(fs)
+ self.__build_clients(fs, clients_json)
sys.stdout.write(json.dumps(self.dump_json))
sys.stdout.write("\n")