Hi,
I'm following this blog to get my feet wet with vCO but it doesnt seem to return the list of all VMs:
Blog:
What I'm using: vCO Appliance 5.5 with vCenter 5.5/ESXi 5.5
Whats happening?
From the policy log, SNMP traps are being received just fine but the VM cannot be located from the inventory. I tried editing the policy to return the number of items in the array that is received from VcPlugin.getAllVirtualMachines() and it's returning as 0.
Not sure what else to do. Do i need to manually connect to vCenter from within the script? From the example in the blog, he just did straight apply / run policy so not sure what gives.
Thanks.
i have this (from the video tutorial):
var allVms = VcPlugin.getAllVirtualMachines(); |
var ret = null; |
System.log("Count " + allVms.length); |
but its returning as Count: 0
Can you see the vms when you browse through the inventory manually in the vco client?
Gesendet von meinem LG Mobile
Hello tschoergez
Yes, I can see the VM's fine when I browse from within the vCO Client (Administer -> vCenter Server)
Here's the script snippet, it returns null
function findVM(vmname) {
var allVms = VcPlugin.getAllVirtualMachines();
var ret = null;
System.log("Count " + allVms.length);
for (var i in allVms) {
System.log("VM is " + allVms[i].name);
if (allVms[i].name.match(vmname)) {
ret = allVms[i];
break;
}
}
return ret;
}
ok. i think i'm going somewhere, it now returned values BUT the new VM created is not on the inventory.
so whats happening from what I can see is: VM is Created -> VcPlugin.getAllVirtualMachines() -> it doesnt return the VM because it cannot see it.
Is there a way i can refresh inventory during run time?