Skip to content

Instantly share code, notes, and snippets.

@schwesig
Last active December 18, 2025 15:38
Show Gist options
  • Select an option

  • Save schwesig/0f25d77f25a73abd547f28688525a347 to your computer and use it in GitHub Desktop.

Select an option

Save schwesig/0f25d77f25a73abd547f28688525a347 to your computer and use it in GitHub Desktop.
S3_Storage_Observability
# S3 on OpenStack NERC, migrated from minio on 2025-06-13 (minio started Jan 15 2025)
## 2025-09-23 03:00pm
### Bucket: acm-metrics
Total Objects: 2512
Total Size: 477.3 GiB
### Bucket: acm-metrics-hypershift2
Total Objects: 1339
Total Size: 14.8 GiB
### Bucket: acm-metrics-test
Total Objects: 1057
Total Size: 20.0 GiB
### Bucket: loki-logs-test
Total Objects: 0
Total Size: 0 Bytes
### Bucket: open-telemetry
Total Objects: 0
Total Size: 0 Bytes
### Bucket: open-telemetry-test
Total Objects: 0
Total Size: 0 Bytes
@schwesig
Copy link
Author

better skript

#!/bin/bash

BUCKET="${1:-acm-metrics}"
DAYS="${2:-30}"
ENDPOINT="https://stack.nerc.mghpcc.org:13808"

echo "Fetching listing for $BUCKET..."
LISTING=$(aws s3 ls "s3://$BUCKET/" --recursive --endpoint-url "$ENDPOINT" 2>&1)

echo ""
echo "| Date | Objects | Size (MiB) | Size (GiB) |"
echo "|------------|---------|------------|------------|"

for i in $(seq 0 $DAYS); do
DAY=$(date -d "-$i day" +%Y-%m-%d)
echo "$LISTING" | grep "$DAY" | awk -v d="$DAY" '
BEGIN{sum=0; count=0}
{sum += $3; count++}
END {
mib = sum/1024/1024
gib = sum/1024/1024/1024
printf "| %s | %7d | %10.2f | %10.2f |\n", d, count, mib, gib
}'
done

echo ""
echo "TOTAL:"
echo "$LISTING" | awk '
BEGIN{sum=0; count=0}
{sum += $3; count++}
END {
printf "Objects: %d, Size: %.2f GiB\n", count, sum/1024/1024/1024
}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment