Created
May 17, 2015 16:34
-
-
Save lamw/d5b8b725f466ee37feb8 to your computer and use it in GitHub Desktop.
Lists of all VSAN Storage Controller sorted from smallest to largest Queue Depth
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 | |
# William Lam | |
# www.virtuallyghetto.com | |
# Lists of all VSAN Storage Controller sorted from smallest to largest Queue Depth | |
import json | |
import urllib2 | |
# download json | |
response = urllib2.urlopen('http://partnerweb.vmware.com/service/vsan/all.json') | |
#load json | |
all_data = json.load(response) | |
ctr_queue_depth = {} | |
for i in all_data['data']['controller']: | |
if i['releases'] != None: | |
for releases in i['releases']: | |
esx_version = i['releases'][releases] | |
for vmk_mod in esx_version: | |
for driver in esx_version[vmk_mod]: | |
try: | |
queue_depth_value = esx_version[vmk_mod][driver]['queueDepth'] | |
except KeyError: | |
queue_depth_value = "Invalid" | |
else: | |
if queue_depth_value != 'Invalid': | |
ctr_queue_depth[str(i['model'])] = int(queue_depth_value) | |
sorted_controllers = sorted(ctr_queue_depth.items(), key=lambda x: x[1]) | |
for i in sorted_controllers: | |
# Controller Name + QD Value | |
print i[0] + "," + str(i[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment