Quantcast
Channel: VMware Communities : Discussion List - vSphere Management SDK
Viewing all 1375 articles
Browse latest View live

Getting Esx and guest Vms Performance Data Using Vmware Sdk vmware.vim C# (vmware management sdk for .net)

$
0
0

I'm using vmware sdk for .net to get overall data from an esx host and its guest vm's

i've connected to esx server and got some data from guest like max cpu,max memory,ip and etc

now i want to get performance data(cpu usage,memory usage,alarms,etc) of both esx server and vm's

I searched everywhere in the internet and documentation but i couldn't find any good samples that works

the only thing I know is to use performance manager!

can anyone help me how to do it in my c# code? this is how i connect to my esx server:

VMware.Vim.VimClientImpl c = new VimClientImpl();

ServiceContent sc = c.Connect("https://<my ip add>/sdk");

UserSession us = c.Login("root", "Mypass");

and to get vms:

IList<VMware.Vim.EntityViewBase> vms = c.FindEntityViews(typeof(VMware.Vim.VirtualMachine), null, null, null);

thank you too much


Query Historical Data using PerformanceManager, C# and VMware.Vim.dll for vSphere 6.5

$
0
0

Hello Forum,

I try to access historical data of packetsRx (or any other Statistics). Querying other data like logs, VMs, etc. on the host is no problem. However, I just can't get any statistics out of the ESXi server.

My approch currently is:

  1. Finding a VM from which I want to query historical data. I save the ManagedObjectReference from vm.Network[0] to a variable.
  2. Getting a PerformanceManager using client.GetView.
  3. Creating a PerfQueryObject and assigning MetricId, IntervalId, Entity and MaxSample.
  4. Calling percormanceManager.QueryPerfObject(perfQuerySpec).

However, this results in an VimException:

The operation is not supported on the object.

Here is a piece of the code I'm currently using:

PerformanceManager perf = (PerformanceManager)client.GetView(client.ServiceContent.PerfManager, null);              PerfQuerySpec spec = new PerfQuerySpec();  spec.MetricId = new PerfMetricId[] { new PerfMetricId() { Instance = "firewall", CounterId = 196612 } }; spec.IntervalId = 20; spec.Entity = netRef; spec.MaxSample = 10;  PerfCompositeMetric pcm = perf.QueryPerfComposite(spec);

Whereby client is the VimClient used to connect to the server, "firewall" is the name of the VM, wherefrom netRef a NetworkInterface is and the CounterId of 196612 should be the packetsRx performance counter.

However, I'm not entirely sure, if I'm doin' the right thing to get some values out of the performance counter. Maybe you could point out for me, in which direction I should look or what i'm doing wrong.

(.NET SDK or Python vmomi namespace) + vSphere 6.5. Get ESXi Server VMFS Datastore SCSI Device Name. Get ESXi Server RDM SCSI Device Name.

$
0
0

Greetings to you!

How can I get SUBJECT info from ESXi Server using .NET vSphere APIs or Python vmomi namespace? 

I really need help! Please respond to me, Dear colleagues! :-)

Big thanks in advance! Good luck! :-)

USE vSphere Management SDK for vSphere 6.7(C#) To ReConfig VM CPU and Memory

$
0
0

I use  vSphere Management SDK for vSphere 6.7  C# Sample Programs (\SDK\vsphere-ws\dotnet\cs\samples\VMReconfig)  to reconfig VM ,it return success,but in fact the VM config has not been modified.

What is the reason for?

 

running result:

企业微信截图_15252562139648.png

modified code, other code has not been repaired:

企业微信截图_15252562775503.png

VMware6.5 html console

Add an existing hard disk

$
0
0

I am trying to use vSphere Management SDK for Java to add an existing hard disk to a VM, which function can i use?

QQ截图20180515141642.png

Using vimPort to createTask failed , reporting task type not correct.

$
0
0

Hi,

Im trying to use VimPortType 's createTask function to create a custome task. the calling is like:

taskInfo = _vimPort.createTask(taskManagerMoref, hostMoref, taskId,null, false, null, null);

the taskManagerMoref is Mof of TaskManager,  taskId is a string , why it throw this taskType not correct exception? is there any restriction of the taskId? thanks.

 

[2018-05-18T02:37:30.135Z] [ERROR] http-bio-5090-exec-7          com.huawei.esdk.storage.model.task.TaskProcessor                  com.sun.xml.internal.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: A specified parameter was not correct: taskType Please see the server log to find more detail regarding exact cause of the failure.
        at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
        at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:124)
        at com.sun.xml.internal.ws.client.sei.StubHandler.readResponse(StubHandler.java:238)
        at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:189)
        at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:276)
        at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:104)
        at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77)
        at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147)
        at com.sun.proxy.$Proxy701.createTask(Unknown Source)

[2018-05-18T02:37:30.135Z] [ERROR] http-bio-5090-exec-7          com.huawei.esdk.storage.model.task.TaskProcessor                  com.sun.xml.internal.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: A specified parameter was not correct: taskType Please see the server log to find more detail regarding exact cause of the failure.
        at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
        at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:124)
        at com.sun.xml.internal.ws.client.sei.StubHandler.readResponse(StubHandler.java:238)
        at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:189)
        at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:276)
        at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:104)
        at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77)
        at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147)
        at com.sun.proxy.$Proxy701.createTask(Unknown Source)

How to generate credential file from SAML token

$
0
0

I want to create a vCenter Plugin using SDK 6.0 , in the vCenter Plugin I want to generate credentials file of vCenter Server to send to another machine and from this machine, it login vCenter automatic, I don't want user to input it manually. Can we create a credentials file from user session or SAML token ?


List all datacenters, hosts, virtual machines using web sdk (suds)

$
0
0

#1 Hello I am using suds and I want to list all the entities like :

datacenter

virtual machines

hosts etc.

 

#2 I also want to understand what is TraverseSpec, container view, property spec. I have been going through documentation but could not figure out what is the difference between all of the mentioned and where to use them ?

vSphere SDK that tells if vCenter supports a particular ESXi version

$
0
0

Hi,

 

Is there a vSphere SDK that will tell if a particular ESXi version is supported by the vCenter server. I want to validate this before I start a host upgrade.

 

Thanks in advance,

Litty Preeth

How to copy Thin Provisioned Disk(vmdk file) from one data store to another through vCenter Server?

$
0
0

Hello all,

 

I am trying to find a way to copy thin provisioned disk (vmdk file) from one data store to another through vCenter Server preserving its thin provision disk type.

I tried using FileManager->CopyDatastoreFile_Task method, but the issue is that this copy method coverts the disk to thick provision eager zeroed. There is no parameter to specify disk type.

I also tried to use VirtualDiskManager->CopyVirtualDisk_Task which has disk type as parameter, but found out that this method is only available only when connected directly to ESXi host.

 

Is there any API similar to CopyVirtualDisk_Task when connected to vCenter Server? Or any API which  can copy thin provisioned disk?

 

Thank you.

How to copy Thin Provisioned Disk(vmdk file) from one data store to another through vCenter Server?

$
0
0

Hello all,

 

I am trying to find a way to copy thin provisioned disk (vmdk file) from one data store to another through vCenter Server preserving its thin provision disk type.

I tried using FileManager->CopyDatastoreFile_Task method, but the issue is that this copy method coverts the disk to thick provision eager zeroed. There is no parameter to specify disk type.

I also tried to use VirtualDiskManager->CopyVirtualDisk_Task which has disk type as parameter, but found out that this method is only available only when connected directly to ESXi host.

 

Is there any API similar to CopyVirtualDisk_Task when connected to vCenter Server? Or any API which can copy thin provisioned disk?

 

Thank you.

GuestOperationsUnavailable

$
0
0

Hello,

 

I need to use the InitiateFileTransferToGuest method to put a file(s) on a VM(s).  I could not get my code to work (no GuestFileManager available?), so I tried to invoke the method using the MOB.  When I do that, I get a message saying, "GuestOperationsUnavailable".  Can anybody tell me what to do to make GuestOperationsAvailable?

 

Much Thanks!

Vmware Vcenter : AccountManager and virtualizationManager in Web Services are Unset

$
0
0

Hello everyone,

 

I'm actually trying to develop a PHP SOAP Client based on VMWare Vsphere Services SDK. I want to create and manager users in Vsphere through API. I can actually retrieve service content through web services, and get all ManagedObjetReferenced behind, except two of it : accountManager and virtualizationManager.

 

When i look into MOB, these are the only two which have as value "Unset", as you can see below.

 

Screenshot-2018-6-28 Managed Object Browser.png

Any idea on how I can set these values to retrieve them through Web Services ?

 

Regards

Jeremy

Unable to create directory using CreateTemporaryDirectoryInGuest

$
0
0

Hi,

 

I am trying to create a directory on RHEL7.3 machine which has latest Vmwaretools installed(version 2147483647).

 

API: CreateTemporaryDirectoryInGuest()

 

Using this API, I am able to create a directory when I pass the path to create a directory as /, /root, /home.

The only problem I am facing is when I do not pass the path to directory or when I pass a /tmp location.

 

When I do not pass the directory path, ideally it should create a directory in /tmp/vmware-root. However, the API is returning the absolute path in this case.

 

Please help me to resolve this issue.

 

Thanks

Shruti


IVirtualMachineOperations.StartProgramInGuest returns -1073740791 instead of the new process id that has been started. Then all further calls fail with internal server error.

$
0
0

We are using vmware management SDK to start an executable on a remote machine managed in a vcenter.

While trying to start the process using "VMware.Interfaces.Operations.IVirtualMachineOperations.StartProgramInGuest" by passing the executable path, instead of receiving the id of the process that has been started, we are receiving -1073740791. And further call to list the running processes on the remote machine also fail with internal server error.

Can you mention why this is happening and the solution to avoid this ?

vSphere Management vs vSphere Automation sdk

$
0
0

Hi All,

I'm trying to write Backup & Restore module of VM using Java based sdk.

I explore lots of documents & finally get confused which SDK should use because there is lots of SDK available such as.

vSphere Management SDK , vSphere Automation sdk,  Virtual Disk Development Kit & etc.

Please, anyone guide me how to proceed with this.

Thanking You !

WinRM issues when using VCSA

$
0
0

I'm really hoping someone can give me some steer with this one, bear in mind I'm not a developer - I'm infrastructure.

We have a lot of automation scripts which run against our Windows based vCentre 6.0 servers.   We are looking at migfrating to VCSA 6.5, but during testing we have experienced the following error when pointing the scripts to the new vCentre appliance.

"WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet."

Our automation team have mentioned a couple of things to me

1. Powershell remoting needs to be made available on the VCSA

2. need to run the invoke-command

I believe the reason why we aren't facing problems on our Windows vCentre server is because we have powershell installed on the server, and WinRM and the invoke-command are using the powershell software and the windows RM service.    On the VCSA we have neither, clearly due to this being non-windows.

What options/workaround are available?

How to invoke scsi inquiry for non standard page for a SCSI LUN

$
0
0

VMware stores the VPD information in standard inquiry property for SCSI LUN. If we want to query other than standard data, is there a API or a way to do this?

 

Thanks

Guru

To fetch if a lun belongs to USB from MOB Query

$
0
0

Hi ,

 

We have a requirement of getting all the ScsiDisk luns , but we need to ignore the luns which are of USB type .

 

Can someone please help me how can I get the information from MOB .

 

--

Regards,

Shu

Viewing all 1375 articles
Browse latest View live


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