Last active
May 6, 2025 19:46
-
-
Save rjhowe/ec2dc650730deea7a88ae5b4b7eb8e83 to your computer and use it in GitHub Desktop.
etcd object size count
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for base in kubernetes openshift; do | |
readarray RESOURCES <<< \ | |
"$(etcdctl --command-timeout=30s \ | |
get --prefix / --keys-only 2>/dev/null | grep -oP "(?<=/${base}.io\/).+?(?=\/)" | sort | uniq)" | |
for res in "${RESOURCES[@]}"; do | |
BYTES=$(etcdctl --command-timeout=30s \ | |
get --prefix /${base}.io/$res -w protobuf | wc -c) | |
COUNT==$(etcdctl --command-timeout=30s \ | |
get --prefix /${base}.io/$res --keys-only | sed '/^$/d' | wc -l) | |
echo "/${base}.io/$res Count=$COUNT Bytes=$BYTES" | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment