Hey Team,
I am looking for an SDK equivalent to POWERCLI GetStat (get statistics data for a VM, filtered according to a condition).
Please advise...
Yours,
Jack.
There is no exact implementation using .NET SDK.
You can use this snipet to get the stats of the VM
Dictionary<string, ReferenceType> orgsList = vcloudClient.GetOrgRefsByName();
foreach (ReferenceType orgRef in orgsList.Values)
{
foreach (ReferenceType vdcRef in Organization.GetOrganizationByReference(vcloudClient, orgRef)
.GetVdcRefs())
{
Vdc vdc = Vdc.GetVdcByReference(vcloudClient, vdcRef);
Console.WriteLine("Vdc : " + vdcRef.name + " : "
+ vdc.Resource.AllocationModel);
foreach (ReferenceType vAppRef in Vdc.GetVdcByReference(
vcloudClient, vdcRef).GetVappRefs())
{
Console.WriteLine(" Vapp : " + vAppRef.name);
Vapp vapp = Vapp.GetVappByReference(vcloudClient, vAppRef);
List<VM> vms = vapp.GetChildrenVms();
foreach (VM vm in vms)
{
Console.WriteLine(" Vm : "
+ vm.Resource.name);
Console.WriteLine(" Status : " + vm.GetVMStatus());
Console.WriteLine(" CPU : "
+ vm.GetCpu().GetNoOfCpus());
Console.WriteLine(" Memory : "
+ vm.GetMemory().GetMemorySize() + " Mb");
foreach (VirtualDisk disk in vm.GetDisks())
try
{
if (disk.IsHardDisk())
Console.WriteLine(" HardDisk : "
+ disk.GetHardDiskSize() + " Mb");
}
catch (Exception e)
{
Logger.Log(TraceLevel.Critical, e.Message);
Console.WriteLine(e.Message);
}
}
}
}
}