Skip to content

Instantly share code, notes, and snippets.

@wido
Created January 30, 2018 09:12
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wido/875d531692a922d608b9392e1766405d to your computer and use it in GitHub Desktop.
Save wido/875d531692a922d608b9392e1766405d to your computer and use it in GitHub Desktop.
Ceph OSD BlueStore database size
#!/bin/bash
# For each running OSD query the BlueStore DB size and entries and calculate avg size per entry
#
# Author: Wido den Hollander <wido@widodh.nl>
#
for OSD_ID in $(find /var/run/ceph -name 'ceph-osd.*.asok' -type s -printf "%f\n"|cut -d '.' -f 2); do
DB_USED_BYTES=$(ceph daemon osd.$OSD_ID perf dump|jq '.bluefs.db_used_bytes')
BLUESTORE_ONODES=$(ceph daemon osd.$OSD_ID perf dump|jq '.bluestore.bluestore_onodes')
echo "osd.$OSD_ID: db_used_bytes=$DB_USED_BYTES bluestore_onodes=$BLUESTORE_ONODES db_entry_size=$(($DB_USED_BYTES / BLUESTORE_ONODES))"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment