Quantcast
Channel: VMware Communities : All Content - vSphere Management SDK
Viewing all 1860 articles
Browse latest View live

Tracking vmotions externally

$
0
0

So, I need to track where some of my vms move around to for Oracle compliance.  I was scraping syslog with Splunk or plain old syslog, but that broke with the 6.7u3 update so I'm trying to find a better way to do it.  I was thinking about creating a custom alarm that sends an e-mail or runs a script but I am not sure the best way to do that, so I have questions:

 

1) For the 'run a script' option, where does it run and with what arguments?

 

2) What target type (Datacenter I think) and condition would best catch all vmotions?

 

I realize this is probably an odd request, so if anyone has any insight into other ways to track it, I'm all ears.

 

Thanks.


VMware remote plugin vCenter support matrix

$
0
0

Hi There,

are there any official document or files for vmware remote plugin vCenter support matrix?

it means the remote plugin is supported from which vCenter version.  I saw there is an remote plugin sample in 6.7u2 (\vSphere\6.7U2\Dec17\vsphere-client-sdk-6.7.0.30000-11233122\html-client-sdk\samples\remote-plugin-sample). it is the lowest support version? does it support previous version before 6.7u2?

Looking forward to your reply. Thanks in advance!

The verification of VimPortType.cloneSession() failed even with a new clone ticket

$
0
0

We have a critical problem when using the new vSphere authentication in our remote plugin server, the below steps of new authentication approach are following the remote plugin sample from the SDK 6.7u3:

  1. Firstly, clone a ticket by sending a REST request ‘/vcenter/session/clone-ticket’ to the vsphere-ui service with vcenterGuid, vmware-api-session-id and vmware-gateway-url.
  2. Then construct a SOAP request to obtain a regular session ID from the Web Services API by using the cloneSession() operation on the VimPort(com.vmware.vim25.VimPortType.cloneSession(), our vim25 version is 6.7-7970399).

The issue is, if the first user with a session id passed the new authentication(step1 & step2), the other users with their new session ids would be failed to pass the verification of step 2 - clone session for VimPort(step 1 still passed), and the error stack like this(attached our log file):

Do anyone have the suggestions for resolving this issue? Appreciate that

Take the VMware Developer Survey for a Chance to Win a Sonos Move

$
0
0

Hello everyone, VMware is conducting our annual Developer Survey and we want to hear from YOU so we can assess and improve our developer program to better serve your needs. PLUS, we will be giving away a new Sonos Move smart speaker to one lucky participant! To take the survey, visit the link below:

http://www.vmware.com/go/developer-survey-2019

Thank you!

Windows vSphere Client (HTML5) service fails to start

$
0
0

My situation is 6.5 upgrade to 6.7u3

Symptoms

Accessing the vSphere Client (HTML5) of vCenter server in browser is failed with error message:

503 Service Unavailable (Failed to connect to endpoint: [class Vmacore::Http::LocalServiceSpec:0x0000025c4df77820] _serverNamespace = /ui action = Allow _port = 5091)

Services status in vCenter server with command "service-control --status --all" shows the "vsphere-ui" service in STOPPED status.

the vsphere_client_virgo.log file, you see entries similar to:

[2020-01-30T01:30:37.230+08:00] [INFO ] cm-catalog-manager-pool-46    com.vmware.vise.vim.lookup.LsCatalogManager                       Time to load properties (ms)C:\ProgramData\VMware\vCenterServer\cfg\vsphere-ui\cmCatalog\com.vmware.cis.cs.eam.zip:US: 2

[2020-01-30T01:30:37.931+08:00] [ERROR] SimpleAsyncTaskExecutor-1     com.vmware.vise.extensionfw.ExtensionManager                      Error retrieving deployment data for the plugin package at C:\ProgramData\VMware\vCenterServer\runtime\vsphere-ui\plugin-packages\vsphere-client

[2020-01-30T01:30:37.942+08:00] [ERROR] SimpleAsyncTaskExecutor-1     com.vmware.vise.util.concurrent.WorkerThread                      SimpleAsyncTaskExecutor-1 terminated with exception:  java.lang.NoClassDefFoundError: java/util/concurrent/ExecutorCompletionService

at com.vmware.vise.extensionfw.impl.PackagesDeployer.<init>(PackagesDeployer.java:160)

at com.vmware.vise.extensionfw.impl.PackagesDeployer.deploy(PackagesDeployer.java:143)

at com.vmware.vise.extensionfw.ExtensionManager.addPluginPackages(ExtensionManager.java:520)

at com.vmware.vise.extensionfw.impl.ExtensionServiceImpl.addPluginPackages(ExtensionServiceImpl.java:164)

at com.vmware.vise.extensionfw.impl.CorePluginsDeploymentActivator.deployPluginsFromDir(CorePluginsDeploymentActivator.java:156)

at com.vmware.vise.extensionfw.impl.CorePluginsDeploymentActivator.deployInternal(CorePluginsDeploymentActivator.java:102)

at com.vmware.vise.extensionfw.impl.CorePluginsDeploymentActivator.access$000(CorePluginsDeploymentActivator.java:27)

at com.vmware.vise.extensionfw.impl.CorePluginsDeploymentActivator$1.run(CorePluginsDeploymentActivator.java:61)

at java.lang.Thread.run(Thread.java:748)

Caused by: java.lang.ClassNotFoundException: Illegal access: this web application instance has been stopped already. Could not load [java.util.concurrent.ExecutorCompletionService]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.

at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1370)

at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1220)

at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1182)

at org.eclipse.equinox.servletbridge.FrameworkLauncher$ChildFirstURLClassLoader.loadClass0(FrameworkLauncher.java:1051)

at org.eclipse.equinox.servletbridge.FrameworkLauncher$ChildFirstURLClassLoader.loadClass(FrameworkLauncher.java:1036)

at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:371)

at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:364)

at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:161)

at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

... 9 common frames omitted

Caused by: java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [java.util.concurrent.ExecutorCompletionService]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.

at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1380)

at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1368)

... 18 common frames omitted

What is the difference between Vsphere Management SDK and Automation SDK?

$
0
0
What is the difference between Vsphere Management SDK and Automation SDK?

Are there any maven repositories for vim25

$
0
0

Hi,

 

Anyone knows which maven repository to use inorder to include vim25 jar the local project?

Thanks in advance.

How to get VirtualMachine moid

$
0
0

I just started working with the MOB and learning about MOID's. I was hoping to get the VirtualMachine MOID. We have ESXi hosts with free license. Any way to get this? I just want to execute VirtualMachine.Interact.PowerOn and .Suspend.

 

Example:

https://balvmware1/mob/?moid=VirtualMachine

 

Any ideas? Or is this justs available via vcenterserver?


Account lockout on vsphere web client and ssh

$
0
0

Hello friends:

 

 

I have the following concern: I have a stand alone esxi version 6.7 server; I had to manage via ssh on the server to set up a trust relationship, and after a while the session ended. When trying to enter the esphere vsphere client via web, it does not allow me to authenticate. The ssh services are still activated on the esxi server, but it also won't let me log in there. The portal and the ssh client only tells me that the username or password is wrong. Can someone tell me why this happens?

Perl API Silent Install

$
0
0

Is there any way to automate the Perl API install?  I want to add it to my kickstart so it is part if the initial build.  Any ideas?

Cannot extract VMs from VRealize with Api WeB

$
0
0

Hello,

I have a PowerShell script that uses the Web API to extract data from host, cluster and VMs on VRealize but since I installed version 6.7 of VSphere, I have data from host, cluster but not those of Vms. I don't know if the metrics have changed but it doesn't work anymore. Can someone help me.
Thank you !

Refresh Network Information

$
0
0

 

I have a script that automates the creation of port groups on an ESX server. It just uses the esxcfg-vswitch tool that comes on each ESX server. The script works just as it should - I can create, update and delete port groups. However, when I create a port group and then use the perl api (VIPerlToolkit) to query the host for configured port groups (returned by $host_view-&gt;network), the newly created port group doesn't show up in the list until I hit the "Refresh" link on the Networking Configuration screen in the VI Client. This obviously makes automation rather difficult since the whole point of the automation is to remove the need to use the VI Client. So, the question is, does the Perl API provide a way to refresh the network information (the equivalent of clicking the "Refresh" link on the network config screen)? I've used $host_view-&gt;update_view_data(), but this appears to have no affect on the network list ($host_view-&gt;network). Any help would be much appreciated.

 

 

 

 

 

 

Thanks,

David

 

 

   

 

 

VM Folder Name

Session not Authenticated - Client received SOAP Fault from server

$
0
0

Hello, 

I am attempting to retrieve HostSystem and VirtualMachine data with the web services API after using the vimport.login() method. I seem to be logging in just fine and retrieving the ServiceContent without error but when I make my API call to retrieve data, I receive the following error

Client received SOAP Fault from server: The session is not authenticated. Please see the server log to find more detail regarding the exact cause of the failure. 

I tried looking through the logs but did not find anything associated with that error. I was initially suspecting that I needed to add a cookie. I found an example in the web services guide for retrieving a cookie from the response headers from the RequestContext as shown below but no "Set-cookie" header exists

requestContext = ((BindingProvider) vimPort).getResponseContext();
headers = (Map<String, Object>) requestContext.get(MessageContext.HTTP_RESPONSE_HEADERS);
List cookies = (List) headers.get("Set-cookie");

Any help would be great!

Getting Properties from a ManagedObjectReference

$
0
0

I am trying to figure out how to get a subset of properties from a ManagedObjectReference to HostSystem.

 

My current use case is that I am using a property collector to retrieve all VirtualMachines. One of the properties I am retrieving is the host property for the VirtualMachine. All I want to get is the name of the host that the VirtualMachine belongs to.

 

If anyone knows how I can do this in Java that would be a huge help!


Programming / Scripting Language used for vSphere Management

$
0
0
We wanted to better understand what language you use or would like to us to develop vSphere Management Applications. Thanks for your time

How to map VirtualMachine virtualDisk metric instance id like scsi0:0 to VirtualDisk object.

$
0
0

I am querying virtual machine and its virtual disk..later getting virtual disk metrics for VM but I am having problem in mapping between VirtualDisk objectId and Virtual machine virtualDisk metric instance id.

When I am getting VirtualDisk from VirtualMachine..I can see its object id something like "20-2000" but metric instance id is like scsi0:0.

So need help regarding above.

 

Thanks.

Find hostsystem by findbyip

$
0
0

Hello,

how to retrieve the information about hostsystem object  by using searchindex.findbyip for ipv6,

Findbyip works fine for ipv4. Is there any workaround to ger hostsystem object by using ipv6 address.

Please do provide answer.

Thanks,

Kedarnath

### Not able to capture VMware event Lost network connectivity for DVSPort

$
0
0

I tried the following code. I am able to see the event in vSphere but not able to capture with code.
I am able to see the descriptions related to event on this particular vCenter. To my un
derstanding this vCenter should capture those events.
When i checked the ouput at the sametime.
I don't have any event related to DVPorts.
Please suggest what might have caused this not to capture and how to go about this.
Any configuration at the vCenter causing this because i am able capture for other vCenter.

package vmware2020;

 

import java.io.File;

import java.io.FileOutputStream;

import java.net.MalformedURLException;

import java.net.URL;

import java.rmi.ConnectException;

import java.rmi.RemoteException;

import java.util.Calendar;

import java.util.Date;

import java.util.HashMap;

 

import com.vmware.vim25.Event;

import com.vmware.vim25.EventFilterSpec;

import com.vmware.vim25.EventFilterSpecByEntity;

import com.vmware.vim25.EventFilterSpecByTime;

import com.vmware.vim25.EventFilterSpecRecursionOption;

import com.vmware.vim25.InvalidLogin;

import com.vmware.vim25.mo.EventManager;

import com.vmware.vim25.mo.ServiceInstance;

import com.vmware.vim25.mo.StoragePod;

 

//java -cp cim-2.0.0.jar:dom4j-2.1.1.jar:jaxb-api-2.3.1.jar:vijava-55b20130927_c04.jar:vmware2020.jar vmware2020.VmwareEvents <IPADDRESS> <USERNAME> <PASSWORD> '443' 'true' -23 HOUR true

 

 

public class VmwareEvents {

    ServiceInstance serviceInstance;

    VmwareServiceApiServiceImpl vmwareServiceApiServiceImpl;

    HashMap<String, StoragePod> dsMap = new HashMap<>();

    HashMap<String, String> dsSpodMap = new HashMap<>();

 

    public static void main(String[] args) throws RemoteException, Exception {

        VmwareEvents auth = new VmwareEvents();

        String ipAddress = args[0];

        String userName = args[1];

        String password = args[2];

        int port = Integer.parseInt(args[3]);

        String isSecure = args[4];

        boolean secure = (isSecure.equalsIgnoreCase("true")) ? true : false;

        int option = Integer.parseInt(args[5]);

        String calendarTag = args[6];

        String endTimeFlag = args[7];

        auth.go(getServiceInstance(ipAddress, userName, password, port, secure), option, calendarTag, endTimeFlag);

    }

 

    private void go(ServiceInstance serviceInstance, int option, String calendarTag, String endTimeFlag) {

        File file = null;

        try {

            this.serviceInstance = serviceInstance;

            String fileName = "vcenter_events_";

        

 

            StringBuffer bf = new StringBuffer();

            EventManager evtManager = this.serviceInstance.getEventManager();

            Event[] events = null;

            if (evtManager != null) {

                EventFilterSpec fSpec = new EventFilterSpec();

                // fSpec.setCategory(null);

                // Need to filter with Time

                EventFilterSpecByTime fTime = new EventFilterSpecByTime();

                // begin time = lastpooled time from if nul api get time

 

                Calendar time = this.serviceInstance.getServerClock();

                System.out.println("TIME: "+time);

                Calendar beginTime = (Calendar) this.serviceInstance.currentTime();

//                System.out.println("BEGIN TIME: "+beginTime);

                Calendar endTime = (Calendar) this.serviceInstance.currentTime();

//                System.out.println("END TIME: "+endTime);

            

//                java.util.GregorianCalendar[time=?,areFieldsSet=false,areAllFieldsSet=true,

//                lenient=true,zone=sun.util.calendar.ZoneInfo[id="GMT+00:00",offset=0,

//                dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,

//                ERA=1,YEAR=2020,MONTH=7,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=5,

//                DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=7,MINUTE=41,SECOND=36,MILLISECOND=916,

//                ZONE_OFFSET=0,DST_OFFSET=0]

            

//                Date date = time.getTime();

//            

//                time.getTimeZone();

//                time.getFirstDayOfWeek();

//                time.getMinimalDaysInFirstWeek();

//            

//            

//                int ERA = time.ERA;

//                int YEAR = time.YEAR;

//                int MONTH = time.MONTH;

//            

//                int WEEK_OF_YEAR = time.WEEK_OF_YEAR;

//                int WEEK_OF_MONTH = time.WEEK_OF_MONTH;

//            

//                int DAY_OF_MONTH = time.DAY_OF_MONTH;

//                int DAY_OF_YEAR = time.DAY_OF_YEAR;

//                int DAY_OF_WEEK = time.DAY_OF_WEEK;

//                int DAY_OF_WEEK_IN_MONTH = time.DAY_OF_WEEK_IN_MONTH;

//            

//                int AM_PM = time.AM_PM;

//                int HOUR = time.HOUR;

//                int HOUR_OF_DAY = time.HOUR_OF_DAY;

//                int MINUTE = time.MINUTE;

//                int SECOND = time.MILLISECOND;

//                int MILLISECOND = time.MILLISECOND;

//                int ZONE_OFFSET = time.ZONE_OFFSET;

//                int DST_OFFSET = time.DST_OFFSET;

            

            

                System.out.println("OPTION: [" + option + "]");

            

                if (calendarTag.equalsIgnoreCase("YEAR")) {

                    beginTime.add(Calendar.YEAR, option);

                } else if (calendarTag.equalsIgnoreCase("MONTH")) {

                    beginTime.add(Calendar.MONTH, option);

                } else if (calendarTag.equalsIgnoreCase("HOUR")) {

                    beginTime.add(Calendar.HOUR, option);

                } else if (calendarTag.equalsIgnoreCase("DAY_OF_WEEK_IN_MONTH")) {

                    beginTime.add(Calendar.DAY_OF_WEEK_IN_MONTH, option);

                } else if (calendarTag.equalsIgnoreCase("DAY_OF_MONTH")) {

                    beginTime.add(Calendar.DAY_OF_MONTH, option);

                }  else if (calendarTag.equalsIgnoreCase("FRIDAY")) {

                    beginTime.add(Calendar.FRIDAY, option);

                }

 

        

                System.out.println("Begin Time " + beginTime.getTime());

                System.out.println("End Time " + endTime.getTime());

                String bt = beginTime.getTime().toString().replaceAll(" ", "_");

                String et = endTime.getTime().toString().replaceAll(" ", "_");

                bt = bt.replaceAll(":", "_");

                et = et.replaceAll(":", "_");

                 file = new File(fileName+bt+"_"+et+"_END_TIME_IS_"+endTimeFlag+".txt");

            

                fTime.setBeginTime(beginTime);

                if (endTimeFlag.equalsIgnoreCase("true")) {

                    fTime.setEndTime(endTime);

                }

                fSpec.setTime(fTime);

 

                // Need to filter with Entity

                EventFilterSpecByEntity entityFilter = new EventFilterSpecByEntity();

                entityFilter.setEntity(this.serviceInstance.getRootFolder().getMOR());

                entityFilter.setRecursion(EventFilterSpecRecursionOption.all);

                fSpec.setEntity(entityFilter);

 

                // Updating with latest time stamp every time

                // VMwareMonitorCacheProvider.addEventLastPolledTimeMap(device.getUniqueId(),

                // entityUuid, api.getCurrentServerTime());

                bf.append(

                        "Name                                                   FullFormatName                                              EventTypeId           \n");

 

                events = evtManager.queryEvents(fSpec);

                System.out.println(evtManager.getLatestEvent().fullFormattedMessage);

                if (events != null) {

                    System.out.println(events.length);

                    for (Event event : events) {

                        if (event instanceof com.vmware.vim25.AlarmStatusChangedEvent) {

                            com.vmware.vim25.AlarmStatusChangedEvent e = (com.vmware.vim25.AlarmStatusChangedEvent) event;

                            bf.append("\t" + e.getClass().getSimpleName() + "   " + "\t" + e.getFullFormattedMessage()

                                    + "\n");

                        } else if (event instanceof com.vmware.vim25.EventEx) {

                            com.vmware.vim25.EventEx e = (com.vmware.vim25.EventEx) event;

                            bf.append("\t" + e.getClass().getSimpleName() + "   " + "\t" + e.getFullFormattedMessage()

                                    + "\t" + e.getEventTypeId() + "\n");

                        } else if (event instanceof com.vmware.vim25.ExtendedEvent) {

                            com.vmware.vim25.ExtendedEvent e = (com.vmware.vim25.ExtendedEvent) event;

                            bf.append("\t" + e.getClass().getSimpleName() + "   " + "\t" + e.getFullFormattedMessage()

                                    + "\t" + e.getEventTypeId() + "\n");

                        } else {

                            bf.append("\t" + event.getClass().getSimpleName() + "   " + "\t"

                                    + event.getFullFormattedMessage() + "\n");

                        }

                    }

                }

            }

 

            byte[] bytes = bf.toString().getBytes();

            try (FileOutputStream fos = new FileOutputStream(file)) {

                fos.write(bytes);

                fos.flush();

            }

 

            if (this.serviceInstance != null) {

                this.serviceInstance.getServerConnection().logout();

            }

        } catch (Exception e) {

            e.printStackTrace();

        }

    }

 

    private static ServiceInstance getServiceInstance(String ipAddress, String userName, String password, int port,

            boolean secure) {

        String apiEndPoint = null;

        URL url = null;

 

        // Create a new ServiceInstance for this API call

        ServiceInstance serviceInstance = null;

 

        try {

            apiEndPoint = secure ? "https://" + ipAddress + ":" + port + "/sdk"

                    : "http://" + ipAddress + ":" + port + "/sdk";

            try {

                url = new URL(apiEndPoint);

            } catch (Exception e) {

                System.out.println(apiEndPoint);

                System.out.println(url);

                e.printStackTrace();

            }

 

            serviceInstance = new ServiceInstance(url, userName, password, true);

 

        } catch (InvalidLogin ile) {

            System.out.println("InvalidLogin");

            ile.printStackTrace();

        } catch (RemoteException re) {

            if (re instanceof InvalidLogin) {

                System.out.println("InvalidLogin2");

            }

 

            if (re instanceof ConnectException) {

                System.out.println("ConnectException");

            }

 

            re.printStackTrace();

        } catch (MalformedURLException me) {

            System.out.println("MalformedURLException");

            me.printStackTrace();

        } catch (Exception e) {

            System.out.println("Exception");

            e.printStackTrace();

        }

        return serviceInstance;

    }

 

    public void logout() throws Exception {

        if (serviceInstance != null) {

            try {

                serviceInstance.getServerConnection().logout();

            } catch (Exception e) {

                e.printStackTrace();

            }

        }

    }

 

}

Query information from VCenter / Host / VMs

$
0
0

Hello friends, are you okay?

I am working on a system that will read information from VCenter / Host / VMs. I identified some existing APIs, they are the API Rest and SOAP (vimService). However, I am not able to consult the same information displayed in Vsphere. The rest API returns data very superficially, while the SOAP API vimService can only obtain results by consulting the Host.

Is there a way to use the same API / Service that Vsphere uses?

Viewing all 1860 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>