Last active
August 1, 2019 10:02
-
-
Save mulbc/7904c0c4c09cf2030487cea2af3f105a to your computer and use it in GitHub Desktop.
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
| #!/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