ceph – sort osds by utilisation

  1. Version 1 – keep it simple

    $ ceph osd df  | awk '{ print "osd."$1, "size: "$5, "usage: " $8 }' | sort -nk5
    

    OSDs can be listed twice – depends on the crushmap.

  2. Version 2 – json + python

    $ ceph osd df tree -f json | python sort_hdd_osds.py
    osd.28  utilization: 15.278888
    osd.15  utilization: 19.700484
    osd.58  utilization: 25.052757
    osd.31  utilization: 28.781335
    osd.22  utilization: 31.525527
    osd.2   utilization: 32.456151
    osd.47  utilization: 32.496669
    osd.39  utilization: 32.598765
    osd.17  utilization: 34.17247
    osd.40  utilization: 34.375297
    osd.56  utilization: 35.102418
    osd.48  utilization: 36.400253
    osd.50  utilization: 36.608321
    osd.52  utilization: 36.628858
    osd.38  utilization: 36.929235
    osd.13  utilization: 37.222498
    osd.30  utilization: 40.405145
    osd.59  utilization: 40.708111
    osd.62  utilization: 40.813985
    osd.43  utilization: 41.488432
    osd.53  utilization: 42.457611
    osd.49  utilization: 42.834021
    osd.23  utilization: 42.907104
    osd.18  utilization: 48.978743
    

    L22@sort_hdd_osds.py – specifies the bucket type which is used (not the device class!)

Leave a Reply

Your email address will not be published. Required fields are marked *