Having some fun with VSAN HCL JSON
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 | |
import json | |
import urllib2 | |
# download json | |
response = urllib2.urlopen('http://partnerweb.vmware.com/service/vsan/all.json') | |
#load json | |
all_data = json.load(response) | |
controllers = {} | |
total = 0 | |
for i in sorted(all_data['data']['controller']): | |
vendor = i['vendor'] | |
if vendor not in controllers.keys(): | |
controllers[vendor] = 1 | |
else: | |
controllers[vendor] += 1 | |
total += 1 | |
print "Total VSAN Controllers: " + str(total) | |
for key,value in controllers.items(): | |
#print str(key) + "," + str(value) | |
per = format((1.0 * value / total) * 100,'.2f') | |
print str(key) + "," + str(per) | |
hdd = {} | |
total = 0 | |
for i in sorted(all_data['data']['hdd']): | |
vendor = i['vendor'] | |
if vendor not in hdd.keys(): | |
hdd[vendor] = 1 | |
else: | |
hdd[vendor] += 1 | |
total += 1 | |
print "Total VSAN HDD: " + str(total) | |
for key,value in hdd.items(): | |
#print str(key) + "," + str(value) | |
per = format((1.0 * value / total) * 100,'.2f') | |
print str(key) + "," + str(per) | |
ssd = {} | |
total = 0 | |
for i in sorted(all_data['data']['ssd']): | |
vendor = i['vendor'] | |
if vendor not in ssd.keys(): | |
ssd[vendor] = 1 | |
else: | |
ssd[vendor] += 1 | |
total += 1 | |
print "Total VSAN SSD: " + str(total) | |
for key,value in ssd.items(): | |
#print str(key) + "," + str(value) | |
per = format((1.0 * value / total) * 100,'.2f') | |
print str(key) + "," + str(per) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment