Hello,
I want to add up the memory used on the Host in a cluster so I can score the clusters find the cluster with the "most free" memroy so far this is what I have. I have trouble adding up the memory on the host however
var byteToMB = 1024*1024;
var mbToGig = 1024
var overCommit = 2;
var datacenter = Server.findForType("VC:Datacenter", "fqdn/datacenter-22");
var clusters = datacenter.hostFolder.childEntity;
//System.log(clusters);
for each (VcComputeResource in clusters) {
var host = VcComputeResource.host;
var name = VcComputeResource.name
var totalMemory = VcComputeResource.summary.totalMemory/byteToMB;
System.log("Total Memory" + " " + "of " + " " + name + " is " + totalMemory);
for each (VcHostSystem in host){
//var hostUsageTotal = 0;
var hostUsage = VcHostSystem.summary.quickStats.overallMemoryUsage;
var hostName = VcHostSystem.name;
System.log(hostName + " " + "has a Memory Usasage of " + " " + hostUsage);
}
}