From 054de46f3b758b727ec8304af2bdd6deef3ff09c Mon Sep 17 00:00:00 2001 From: Ho Kim Date: Sun, 8 Sep 2024 19:21:07 +0000 Subject: [PATCH] feat(utils): add ceph disk size collector --- utils/batch-reduce-all.sh | 5 ++--- utils/batch-reduce-template-ceph-disk-size.sh | 9 +++++++++ utils/batch-reduce-template-estimate-speed.sh | 0 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100755 utils/batch-reduce-template-ceph-disk-size.sh mode change 100644 => 100755 utils/batch-reduce-template-estimate-speed.sh diff --git a/utils/batch-reduce-all.sh b/utils/batch-reduce-all.sh index 4f703602..d2ebbd45 100755 --- a/utils/batch-reduce-all.sh +++ b/utils/batch-reduce-all.sh @@ -31,9 +31,8 @@ SSH_KEYFILE_PATH="${SSH_KEYFILE_PATH:-$SSH_KEYFILE_PATH_DEFAULT}" echo 'box,label,value' >>"${DST_PATH}" echo 'Running for boxes' -for line in $(cat "${CSV_PATH}" | tail '+2'); do - box_id="$(echo "${line}" | cut '-d,' -f1)" - box_name="$(echo "${line}" | cut '-d,' -f2)" +for box_id in $(kubectl get box -o jsonpath='{.items[*].metadata.name}'); do + box_name=$(kubectl get box "${box_id}" --no-headers | awk '{print $2}') echo -n "* ${box_name} -> " echo -n "${box_id},${box_name}," >>"${DST_PATH}" diff --git a/utils/batch-reduce-template-ceph-disk-size.sh b/utils/batch-reduce-template-ceph-disk-size.sh new file mode 100755 index 00000000..3c8291cc --- /dev/null +++ b/utils/batch-reduce-template-ceph-disk-size.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +exec echo "$( + lsblk -bdno NAME,FSTYPE,SIZE,TYPE | + grep -P ' ceph_bluestore ' | + awk '{print $3}' | + paste -sd+ - | + bc +)" diff --git a/utils/batch-reduce-template-estimate-speed.sh b/utils/batch-reduce-template-estimate-speed.sh old mode 100644 new mode 100755