From a1a767859fcdf8c6aeac1e477df2129d4a46e04e Mon Sep 17 00:00:00 2001 From: Anuj Phadke Date: Fri, 5 Aug 2022 13:03:51 -0700 Subject: [PATCH] Get CF level disk usage via JMXNodetool --- .../netflix/priam/connection/JMXNodeTool.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/priam/src/main/java/com/netflix/priam/connection/JMXNodeTool.java b/priam/src/main/java/com/netflix/priam/connection/JMXNodeTool.java index 7f8d62540..548820909 100644 --- a/priam/src/main/java/com/netflix/priam/connection/JMXNodeTool.java +++ b/priam/src/main/java/com/netflix/priam/connection/JMXNodeTool.java @@ -271,6 +271,30 @@ public JSONObject estimateKeys() throws JSONException { return object; } + /** + * Get CF level disk usage + * + * @return + */ + public JSONObject getCFDiskUsage() throws JSONException { + Iterator> it = + super.getColumnFamilyStoreMBeanProxies(); + JSONObject object = new JSONObject(); + + while (it.hasNext()) { + Entry entry = it.next(); + object.put("keyspace", entry.getKey()); + object.put("column_family", entry.getValue().getColumnFamilyName()); + object.put( + "live_disk_size", + super.getColumnFamilyMetric( + entry.getKey(), + entry.getValue().getColumnFamilyName(), + "liveDiskSpaceUsed")); + } + return object; + } + public JSONObject info() throws JSONException { JSONObject object = new JSONObject(); object.put("gossip_active", isInitialized());