Skip to content

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

Merged
cbodley merged 3 commits into
ceph:mainfrom
cbodley:wip-rgw-export-bucket-usage
Oct 27, 2026
Merged

cbodley merged 3 commits into
ceph:mainfrom
cbodley:wip-rgw-export-bucket-usage

Conversation

@cbodley

@cbodley cbodley commented Dec 17, 2025 •

Copy link
Copy Markdown
Contributor

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:

  • send as PUT request, not POST
  • support multiple zones, labeling metrics by zone-id
  • add metrics for compressed size, and bucket quota size/objects, and owner quota size/objects
  • 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

cbodley commented Dec 17, 2025 •

Copy link
Copy Markdown
Contributor Author

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 ceph_rgw_bucket_usage_objects gauge
# HELP ceph_rgw_bucket_usage_objects Total number of objects stored in the bucket
# TYPE ceph_rgw_bucket_usage_bytes gauge
# HELP ceph_rgw_bucket_usage_bytes Total size in bytes of logical object data stored in the bucket
# TYPE ceph_rgw_bucket_usage_bytes_utilized gauge
# HELP ceph_rgw_bucket_usage_bytes_utilized Total size in bytes of compressed object data stored in the bucket
# TYPE ceph_rgw_bucket_quota_objects gauge
# HELP ceph_rgw_bucket_quota_objects Maximum number of objects per bucket quota
# TYPE ceph_rgw_bucket_quota_bytes gauge
# HELP ceph_rgw_bucket_quota_bytes Maximum size in bytes of object data per bucket quota
# TYPE ceph_rgw_owner_quota_objects gauge
# HELP ceph_rgw_owner_quota_objects Maximum number of objects per user/account quota
# TYPE ceph_rgw_owner_quota_bytes gauge
# HELP ceph_rgw_owner_quota_bytes Maximum size in bytes of object data per user/account quota
ceph_rgw_bucket_usage_objects{zone="3a84e565-f8b3-4fdf-97d8-6f96e0ac26ab",tenant="",owner="testid",bucket="testbucket"} 1
ceph_rgw_bucket_usage_bytes{zone="3a84e565-f8b3-4fdf-97d8-6f96e0ac26ab",tenant="",owner="testid",bucket="testbucket"} 33554432
ceph_rgw_bucket_usage_bytes_utilized{zone="3a84e565-f8b3-4fdf-97d8-6f96e0ac26ab",tenant="",owner="testid",bucket="testbucket"} 33554432
ceph_rgw_bucket_usage_objects{zone="3a84e565-f8b3-4fdf-97d8-6f96e0ac26ab",tenant="testx",owner="testx$9876543210abcdef0123456789abcdef0123456789abcdef0123456789abcdef",bucket="testbucket"} 0
ceph_rgw_bucket_usage_bytes{zone="3a84e565-f8b3-4fdf-97d8-6f96e0ac26ab",tenant="testx",owner="testx$9876543210abcdef0123456789abcdef0123456789abcdef0123456789abcdef",bucket="testbucket"} 0
ceph_rgw_bucket_usage_bytes_utilized{zone="3a84e565-f8b3-4fdf-97d8-6f96e0ac26ab",tenant="testx",owner="testx$9876543210abcdef0123456789abcdef0123456789abcdef0123456789abcdef",bucket="testbucket"} 0
ceph_rgw_bucket_quota_objects{zone="3a84e565-f8b3-4fdf-97d8-6f96e0ac26ab",tenant="",owner="testid",bucket="testbucket"} 10
ceph_rgw_owner_quota_objects{zone="3a84e565-f8b3-4fdf-97d8-6f96e0ac26ab",tenant="testx",owner="testx$9876543210abcdef0123456789abcdef0123456789abcdef0123456789abcdef"} 9
ceph_rgw_owner_quota_bytes{zone="3a84e565-f8b3-4fdf-97d8-6f96e0ac26ab",tenant="",owner="testid"} 1024
ceph_rgw_owner_quota_objects{zone="3a84e565-f8b3-4fdf-97d8-6f96e0ac26ab",tenant="",owner="RGW11111111111111111"} 10

@batrick batrick added the rgw label Jan 15, 2026
@cbodley
cbodley force-pushed the wip-rgw-export-bucket-usage branch 2 times, most recently from f873aff to 17382a5 Compare March 3, 2026 20:00
@cbodley
cbodley force-pushed the wip-rgw-export-bucket-usage branch from 2ad73ef to ca415ab Compare March 24, 2026 14:43
@cbodley
cbodley force-pushed the wip-rgw-export-bucket-usage branch from ca415ab to 7b07550 Compare March 24, 2026 19:35
cbodley added 3 commits April 21, 2026 09:59
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 <[email protected]>
in addition to bucket_quota metrics from 'radosgw-admin bucket stats',
include owner_quota metrics by listing and reading all users and
accounts

while the bucket_quota metrics are useful when filtering bucket_usage
by a bucket label, the owner_quota metrics are more useful when
filtering bucket_usage by an owner label

while all of the bucket_quota metrics can be fetched in a single
radosgw-admin command, the owner quota metrics must be fetched with a
separate radosgw-admin command for each individual user/account. this
may take considerably longer

Signed-off-by: Casey Bodley <[email protected]>
@cbodley
cbodley force-pushed the wip-rgw-export-bucket-usage branch from 7b07550 to 23fc5fb Compare April 21, 2026 13:59
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@github-actions github-actions Bot added the stale label Jun 20, 2026
@cbodley cbodley added pinned Use this label if you want to exempt a PR from being stalled and removed stale labels Jun 22, 2026
@cbodley
cbodley marked this pull request as ready for review October 1, 2026 12:51
@cbodley
cbodley requested a review from a team as a code owner October 1, 2026 12:51
@cbodley

cbodley commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

discover pushgateway endpoint with ceph orch ls --service_name pushgateway --format json (blocked on cephadm?)

removed this TODO item - the PROMETHEUS_PUSHGATEWAY_ENDPOINT environment variable is sufficient. the caller can 'ceph orch ls' or whatever else to supply that variable

@cbodley
cbodley requested review from a team and anmolbabu and removed request for a team October 1, 2026 12:54
ujjawal-ibm added a commit to ujjawal-ibm/ceph that referenced this pull request Oct 14, 2026
Add metrics_push_enabled, metrics_push_interval, and metrics_push_timeout
to RGWSpec. When enabled, cephadm deploys a systemd timer that periodically
exec's into the RGW container, runs rgw-export-bucket-usage, and pushes
per-bucket usage metrics to a discovered pushgateway endpoint. Timer and
associated units are cleaned up on daemon removal.

Depends-on: ceph#66671
Fixes: https://tracker.ceph.com/issues/81767
Signed-off-by: Ujjawal Anand <[email protected]>
@cloudbehl
cloudbehl requested a review from aaSharma14 October 14, 2026 16:01
ujjawal-ibm added a commit to ujjawal-ibm/ceph that referenced this pull request Oct 15, 2026
Add metrics_push_enabled, metrics_push_interval, and metrics_push_timeout
to RGWSpec. When enabled, cephadm deploys a systemd timer that periodically
exec's into the RGW container, runs rgw-export-bucket-usage, and pushes
per-bucket usage metrics to a discovered pushgateway endpoint. Timer and
associated units are cleaned up on daemon removal.

Depends-on: ceph#66671
Fixes: https://tracker.ceph.com/issues/81767
Signed-off-by: Ujjawal Anand <[email protected]>
ujjawal-ibm added a commit to ujjawal-ibm/ceph that referenced this pull request Oct 15, 2026
Add metrics_push_enabled, metrics_push_interval, and metrics_push_timeout
to RGWSpec. When enabled, cephadm deploys a systemd timer that periodically
exec's into the RGW container, runs rgw-export-bucket-usage, and pushes
per-bucket usage metrics to a discovered pushgateway endpoint. Timer and
associated units are cleaned up on daemon removal.

Depends-on: ceph#66671
Fixes: https://tracker.ceph.com/issues/81767
Signed-off-by: Ujjawal Anand <[email protected]>
ujjawal-ibm added a commit to ujjawal-ibm/ceph that referenced this pull request Oct 15, 2026
Add metrics_push_enabled, metrics_push_interval, and metrics_push_timeout
to RGWSpec. When enabled, cephadm deploys a systemd timer that periodically
exec's into the RGW container, runs rgw-export-bucket-usage, and pushes
per-bucket usage metrics to a discovered pushgateway endpoint. Timer and
associated units are cleaned up on daemon removal.

Depends-on: ceph#66671
Fixes: https://tracker.ceph.com/issues/81767
Signed-off-by: Ujjawal Anand <[email protected]>
ujjawal-ibm added a commit to ujjawal-ibm/ceph that referenced this pull request Oct 16, 2026
Add metrics_push_enabled, metrics_push_interval, and metrics_push_timeout
to RGWSpec. When enabled, cephadm deploys a systemd timer that periodically
exec's into the RGW container, runs rgw-export-bucket-usage, and pushes
per-bucket usage metrics to a discovered pushgateway endpoint. Timer and
associated units are cleaned up on daemon removal.

Depends-on: ceph#66671
Fixes: https://tracker.ceph.com/issues/81767
Signed-off-by: Ujjawal Anand <[email protected]>

@aaSharma14 aaSharma14 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested this PR locally, works as expected.

ujjawal-ibm added a commit to ujjawal-ibm/ceph that referenced this pull request Oct 26, 2026
Add metrics_push_enabled, metrics_push_interval, and metrics_push_timeout
to RGWSpec. When enabled, cephadm deploys a systemd timer that periodically
exec's into the RGW container, runs rgw-export-bucket-usage, and pushes
per-bucket usage metrics to a discovered pushgateway endpoint. Timer and
associated units are cleaned up on daemon removal.

Depends-on: ceph#66671
Fixes: https://tracker.ceph.com/issues/81767
Signed-off-by: Ujjawal Anand <[email protected]>
ujjawal-ibm added a commit to ujjawal-ibm/ceph that referenced this pull request Oct 26, 2026
Add metrics_push_enabled, metrics_push_interval, and metrics_push_timeout
to RGWSpec. When enabled, cephadm deploys a systemd timer that periodically
exec's into the RGW container, runs rgw-export-bucket-usage, and pushes
per-bucket usage metrics to a discovered pushgateway endpoint. Timer and
associated units are cleaned up on daemon removal.

Depends-on: ceph#66671
Fixes: https://tracker.ceph.com/issues/81767
Signed-off-by: Ujjawal Anand <[email protected]>
ujjawal-ibm added a commit to ujjawal-ibm/ceph that referenced this pull request Oct 26, 2026
Add metrics_push_enabled, metrics_push_interval, and metrics_push_timeout
to RGWSpec. When enabled, cephadm deploys a systemd timer that periodically
exec's into the RGW container, runs rgw-export-bucket-usage, and pushes
per-bucket usage metrics to a discovered pushgateway endpoint. Timer and
associated units are cleaned up on daemon removal.

Depends-on: ceph#66671
Fixes: https://tracker.ceph.com/issues/81767
Signed-off-by: Ujjawal Anand <[email protected]>
ujjawal-ibm added a commit to ujjawal-ibm/ceph that referenced this pull request Oct 26, 2026
Add metrics_push_enabled, metrics_push_interval, and metrics_push_timeout
to RGWSpec. When enabled, cephadm deploys a systemd timer that periodically
exec's into the RGW container, runs rgw-export-bucket-usage, and pushes
per-bucket usage metrics to a discovered pushgateway endpoint. Timer and
associated units are cleaned up on daemon removal.

Depends-on: ceph#66671
Fixes: https://tracker.ceph.com/issues/81767
Signed-off-by: Ujjawal Anand <[email protected]>
@cbodley
cbodley merged commit bf60d86 into ceph:main Oct 27, 2026
7 of 9 checks passed
@cbodley
cbodley deleted the wip-rgw-export-bucket-usage branch October 27, 2026 13:11
ujjawal-ibm added a commit to ujjawal-ibm/ceph that referenced this pull request Oct 28, 2026
Add metrics_push_enabled, metrics_push_interval, and metrics_push_timeout
to RGWSpec. When enabled, cephadm deploys a systemd timer that periodically
exec's into the RGW container, runs rgw-export-bucket-usage, and pushes
per-bucket usage metrics to a discovered pushgateway endpoint. Timer and
associated units are cleaned up on daemon removal.

Depends-on: ceph#66671
Fixes: https://tracker.ceph.com/issues/81767
Signed-off-by: Ujjawal Anand <[email protected]>
ujjawal-ibm added a commit to ujjawal-ibm/ceph that referenced this pull request Oct 28, 2026
Add metrics_push_enabled, metrics_push_interval, and metrics_push_timeout
to RGWSpec. When enabled, cephadm deploys a systemd timer that periodically
exec's into the RGW container, runs rgw-export-bucket-usage, and pushes
per-bucket usage metrics to a discovered pushgateway endpoint. Timer and
associated units are cleaned up on daemon removal.

Depends-on: ceph#66671
Fixes: https://tracker.ceph.com/issues/81767
Signed-off-by: Ujjawal Anand <[email protected]>
ujjawal-ibm added a commit to ujjawal-ibm/ceph that referenced this pull request Oct 28, 2026
Add metrics_push_enabled, metrics_push_interval, and metrics_push_timeout
to RGWSpec. When enabled, cephadm deploys a systemd timer that periodically
exec's into the RGW container, runs rgw-export-bucket-usage, and pushes
per-bucket usage metrics to a discovered pushgateway endpoint. Timer and
associated units are cleaned up on daemon removal.

Depends-on: ceph#66671
Fixes: https://tracker.ceph.com/issues/81767
Signed-off-by: Ujjawal Anand <[email protected]>
ujjawal-ibm added a commit to ujjawal-ibm/ceph that referenced this pull request Oct 29, 2026
Add metrics_push_enabled, metrics_push_interval, and metrics_push_timeout
to RGWSpec. When enabled, cephadm deploys a systemd timer that periodically
exec's into the RGW container, runs rgw-export-bucket-usage, and pushes
per-bucket usage metrics to a discovered pushgateway endpoint. Timer and
associated units are cleaned up on daemon removal.

Depends-on: ceph#66671
Fixes: https://tracker.ceph.com/issues/81767
Signed-off-by: Ujjawal Anand <[email protected]>
ujjawal-ibm added a commit to ujjawal-ibm/ceph that referenced this pull request Oct 29, 2026
Add metrics_push_enabled, metrics_push_interval, and metrics_push_timeout
to RGWSpec. When enabled, cephadm deploys a systemd timer that periodically
exec's into the RGW container, runs rgw-export-bucket-usage, and pushes
per-bucket usage metrics to a discovered pushgateway endpoint. Timer and
associated units are cleaned up on daemon removal.

Depends-on: ceph#66671
Fixes: https://tracker.ceph.com/issues/81767
Signed-off-by: Ujjawal Anand <[email protected]>
ujjawal-ibm added a commit to ujjawal-ibm/ceph that referenced this pull request Nov 2, 2026
Add metrics_push_enabled, metrics_push_interval, and metrics_push_timeout
to RGWSpec. When enabled, cephadm deploys a systemd timer that periodically
exec's into the RGW container, runs rgw-export-bucket-usage, and pushes
per-bucket usage metrics to a discovered pushgateway endpoint. Timer and
associated units are cleaned up on daemon removal.

Depends-on: ceph#66671
Fixes: https://tracker.ceph.com/issues/81767
Signed-off-by: Ujjawal Anand <[email protected]>
ujjawal-ibm added a commit to ujjawal-ibm/ceph that referenced this pull request Nov 2, 2026
Add metrics_push_enabled, metrics_push_interval, and metrics_push_timeout
to RGWSpec. When enabled, cephadm deploys a systemd timer that periodically
exec's into the RGW container, runs rgw-export-bucket-usage, and pushes
per-bucket usage metrics to a discovered pushgateway endpoint. Timer and
associated units are cleaned up on daemon removal.

Depends-on: ceph#66671
Fixes: https://tracker.ceph.com/issues/81767
Signed-off-by: Ujjawal Anand <[email protected]>
Co-authored-by: Cursor <[email protected]>
ujjawal-ibm added a commit to ujjawal-ibm/ceph that referenced this pull request Nov 2, 2026
Add metrics_push_enabled, metrics_push_interval, and metrics_push_timeout
to RGWSpec. When enabled, cephadm deploys a systemd timer that periodically
exec's into the RGW container, runs rgw-export-bucket-usage, and pushes
per-bucket usage metrics to a discovered pushgateway endpoint. Timer and
associated units are cleaned up on daemon removal.

Depends-on: ceph#66671
Fixes: https://tracker.ceph.com/issues/81767
Signed-off-by: Ujjawal Anand <[email protected]>
Co-authored-by: Cursor <[email protected]>
ujjawal-ibm added a commit to ujjawal-ibm/ceph that referenced this pull request Nov 3, 2026
Add metrics_push_enabled, metrics_push_interval, and metrics_push_timeout
to RGWSpec. When enabled, cephadm deploys a systemd timer that periodically
exec's into the RGW container, runs rgw-export-bucket-usage, and pushes
per-bucket usage metrics to a discovered pushgateway endpoint. Timer and
associated units are cleaned up on daemon removal.

Depends-on: ceph#66671
Fixes: https://tracker.ceph.com/issues/81767
Signed-off-by: Ujjawal Anand <[email protected]>
Co-authored-by: Cursor <[email protected]>
ujjawal-ibm added a commit to ujjawal-ibm/ceph that referenced this pull request Nov 4, 2026
Add metrics_push_enabled, metrics_push_interval, and metrics_push_timeout
to RGWSpec. When enabled, cephadm deploys a systemd timer that periodically
exec's into the RGW container, runs rgw-export-bucket-usage, and pushes
per-bucket usage metrics to a discovered pushgateway endpoint. Timer and
associated units are cleaned up on daemon removal.

Depends-on: ceph#66671
Fixes: https://tracker.ceph.com/issues/81767
Signed-off-by: Ujjawal Anand <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build/ops pinned Use this label if you want to exempt a PR from being stalled rgw

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants