#!/usr/bin/env python2 | |
import rados | |
import sys | |
import time | |
cluster = rados.Rados(conffile='/etc/ceph/ceph.conf') | |
cluster.connect() | |
for pool in cluster.list_pools(): | |
key_bytes = 0 | |
key_count = 0 | |
value_bytes = 0 | |
value_count = 0 | |
print('Processing pool {}'.format(pool)) | |
start_time = time.time() | |
ioctx = cluster.open_ioctx(pool) | |
with rados.ReadOpCtx(ioctx) as read_op: | |
for objectname in ioctx.list_objects(): | |
iter, ret = ioctx.get_omap_vals(read_op, '', '', 999999) | |
ioctx.operate_read_op(read_op, objectname.key) | |
for key, value in iter: | |
key_bytes += len(key) | |
key_count += 1 | |
value_bytes += len(value) | |
value_count += 1 | |
end_time = time.time() | |
print('Finished pool {} in {}s'.format(pool, (end_time - start_time))) | |
print('key_bytes {}'.format(key_bytes)) | |
print('key_count {}'.format(key_count)) | |
print('value_bytes {}'.format(value_bytes)) | |
print('value_count {}'.format(value_count)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment