Skip to content

tools/rgw: add rgw-export-bucket-usage#66671

Draft
cbodley wants to merge 3 commits intoceph:mainfrom
cbodley:wip-rgw-export-bucket-usage
Draft

tools/rgw: add rgw-export-bucket-usage#66671
cbodley wants to merge 3 commits intoceph:mainfrom
cbodley:wip-rgw-export-bucket-usage

Conversation

@cbodley
Copy link
Contributor

@cbodley cbodley commented Dec 17, 2025

an experimental bash script that converts 'radosgw-admin bucket stats' output into prometheus labeled metrics, then pushes them to prometheus pushgateway as documented in https://github.com/prometheus/pushgateway/

rgw-format-bucket-usage was split out for testing the output for different buckets, users, and tenants

TODO:

  • discover pushgateway endpoint with ceph orch ls --service_name pushgateway --format json
  • send as PUT request, not POST
  • support multiple zones, labeling metrics by zone-id
  • add script to runs rgw-export-bucket-usage on a timer (for use as a container entrypoint)
  • package scripts so they're installed in the ceph container
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@cbodley
Copy link
Contributor Author

cbodley commented Dec 17, 2025

tested by creating two buckets named "testbucket", one as the vstart user "testid", and one as vstart tenanted user "testx$9876543210abcdef0123456789abcdef0123456789abcdef0123456789abcdef". i uploaded one object to the first bucket only, meaning that usage information for the second bucket was empty: "usage": {}

~/ceph/build $ PATH=bin:$PATH ../src/tools/rgw/rgw-format-bucket-usage
# TYPE rgw_bucket_usage_objects guage
# HELP rgw_bucket_usage_objects Total number of objects stored in the bucket
# TYPE rgw_bucket_usage_bytes guage
# HELP rgw_bucket_usage_bytes Total size in bytes of object data stored in the bucket
rgw_bucket_usage_objects{realm="",zone="3a84e565-f8b3-4fdf-97d8-6f96e0ac26ab",tenant="",owner="testid",bucket="testbucket"} 1
rgw_bucket_usage_bytes{realm="",zone="3a84e565-f8b3-4fdf-97d8-6f96e0ac26ab",tenant="",owner="testid",bucket="testbucket"} 294
rgw_bucket_usage_objects{realm="",zone="3a84e565-f8b3-4fdf-97d8-6f96e0ac26ab",tenant="testx",owner="testx$9876543210abcdef0123456789abcdef0123456789abcdef0123456789abcdef",bucket="testbucket"} 0
rgw_bucket_usage_bytes{realm="",zone="3a84e565-f8b3-4fdf-97d8-6f96e0ac26ab",tenant="testx",owner="testx$9876543210abcdef0123456789abcdef0123456789abcdef0123456789abcdef",bucket="testbucket"} 0

an experimental bash script that converts 'radosgw-admin bucket stats'
output into prometheus labeled metrics, then pushes them to prometheus
pushgateway as documented in https://github.com/prometheus/pushgateway/

rgw-format-bucket-usage was split out for testing the output for
different buckets, users, and tenants

Signed-off-by: Casey Bodley <cbodley@redhat.com>
@cbodley cbodley force-pushed the wip-rgw-export-bucket-usage branch from d7a4046 to f873aff Compare March 3, 2026 19:54
cbodley added 2 commits March 3, 2026 14:59
loop over all zones and export stats labeled by zone id
send as a PUT request to instruct pushgateway to replace all metrics in
the group instead of updating them with POST. this clears any metrics
associated with deleted buckets which would otherwise need manual
cleanup
@cbodley cbodley force-pushed the wip-rgw-export-bucket-usage branch from f873aff to 17382a5 Compare March 3, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants