public static void main(String[] args) throws Exception { long start = System.currentTimeMillis(); ServiceInstance si = SampleUtil.createServiceInstance(); long end = System.currentTimeMillis(); Folder rootFolder = si.getRootFolder(); System.out.println("time taken:" + (end - start)); String name = rootFolder.getName(); System.out.println("vc root folder:" + name); ManagedEntity[] mes = new InventoryNavigator(rootFolder).searchManagedEntities("VirtualMachine"); if (mes == null || mes.length == 0) { return; } VirtualMachine vm = (VirtualMachine) mes[0]; VirtualMachineConfigInfo vminfo = vm.getConfig(); VirtualMachineCapability vmc = vm.getCapability(); System.out.println("Name: " + vm.getName()); System.out.println("IP: " + vm.getGuest().getIpAddress()); System.out.println("FQDN: " + vm.getGuest().getHostName()); System.out.println("MOID: " + vm.getMOR().val); System.out.println("InstanceUUID: " + vm.getSummary().getConfig().getInstanceUuid()); System.out.println("GuestOS: " + vminfo.getGuestFullName()); System.out.println("Multiple snapshot supported: " + vmc.isMultipleSnapshotsSupported()); si.getServerConnection().logout(); }
setVal(n, "vmw_guestIpAddress", g.getIpAddress()); setVal(n, "vmw_guestId", g.getGuestId()); setVal(n, "vmw_guestHostName", g.getHostName()); setVal(n, "vmw_guestAlternateName", cfg.getAlternateGuestName()); setVal(n, "vmw_guestToolsRunningStatus",""+g.getToolsRunningStatus());