Skip to content

Instantly share code, notes, and snippets.

@lamw
Created May 17, 2015 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lamw/d5b8b725f466ee37feb8 to your computer and use it in GitHub Desktop.
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
#!/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