Created
November 4, 2014 18:05
-
-
Save linuxkidd/77d4287c01e0136c2c51 to your computer and use it in GitHub Desktop.
Get full DF output for all OSDs in a Ceph Cluster from Ceph itself.
This file contains 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 python | |
import json,sys | |
from subprocess import Popen, PIPE | |
from StringIO import StringIO | |
r = Popen(['ceph','report'],stdout=PIPE,stderr=PIPE) | |
cephreport, _ = r.communicate() | |
obj=json.load(StringIO(cephreport)) | |
print " OSD\t Size\t Used\t Avail\t Use%" | |
for OSD in obj['pgmap']['osd_stats']: | |
outline="{0:5d}\t".format(OSD['osd']) | |
for i in [ 'kb', 'kb_used', 'kb_avail' ]: | |
outline+="{0:12d}\t".format(OSD[i]) | |
usep=float(OSD['kb_used'])/float(OSD['kb'])*100; | |
print outline+"{0:6.2f}".format(usep) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment