VMware {code} Community
gkhays
Contributor
Contributor

CIM Client in C# or C++

I am attempting to connect to the CIMOM on 3i from a Windows-based CIM client. I have been able to connect and list VMs using listVMs.py in the SDK samples. However, I am not having any luck with the .NET-based wbemsharp or openwbem, see links below. I have not tried wiseman or Java since our development environment is primarily C+ and C++. I have avoided the Pegasus client thus far as I must build the client from sources, and my first attempt was unsuccessful. Has anyone had any luck in connecting from the clients mentioned above? Thank you!

http://code.google.com/p/wbemtools/

http://openwbem.sourceforge.net/

0 Kudos
11 Replies
gkhays
Contributor
Contributor

I broke down and built Pegasus with OpenSSL support under Windows. No joy.

C:\Development\pegasus\bin>cimcli niall -n vmware/esxv2 -l houengesxt02:5989 -u **** -p *********** -d

cimcli Pegasus Exception: Connection closed by CIM Server.. Cmd = niall Object =

Any tips for getting the Pegasus client working? Thanks!

0 Kudos
gkhays
Contributor
Contributor

More details from the Pegasus CIM client. I invoked the test client utility as follows.

TestClient -user <username> -password <password> <myesx>:5989

Config file from //cimserver.conf

Namespace = root/cimv2

Username = <username>

password = <password>

Connecting to <host>:5989

Client Connected

++++ Begin tests... ++++

++++ Test NameSpace Operations ++++

Connection closed by CIM Server.

+++++ Overall time taken for the operation +++++

In 1.01657 Seconds

This is the entry that gets written to syslog.

<27>sfcb[7456650]: *** 1336 Error accepting SSL connection -- exiting

0 Kudos
gkhays
Contributor
Contributor

Update: A variety of CIM clients work great with ESX v3.0.1 and v3.0.2. It seems the problems I am observing are solely with 3i or ESXi.

0 Kudos
admin
Immortal
Immortal

It sounds like you're having issues with the client-side certificate. For some reason, the server is rejecting it. If you can configure your client/system settings such that the client cert isn't passed to the server, that may address the problem. (the server doesn't require client side certificates, but will attempt to validate them if they're sent.)

For development purposes, you can enable non-SSL support. On 3i, point a web editor (mozilla composer, etc.) at https://<hostname>/host/sfcb.cfg then edit the file so restrictHttpToLoopback is false, then "publish" the file back to the server (http put). Restart management agents (through the console DCUI) or reboot the server and the changes will take affect.

0 Kudos
Anandraj
Contributor
Contributor

Hi,

I'm new to CIM Client. I'm trying to connect CIM thru C#. Can u plz help. I just go thru the CIM SDK. I don't know how to start with.

Anand.

0 Kudos
Anandraj
Contributor
Contributor

Hi ,

I'm just trying the same, want to connect esxi 4.0 using wbem-sharp. Can u plz help me.

Anand.

0 Kudos
harkamal
Expert
Expert

did you had any luck with wbem-csharp ? i am stuck as well...appreciate if you can share some knowledge pls.thanks

0 Kudos
webwarrior
Contributor
Contributor

No one seems to get this working?

It only works agains Windows machines, and not ESX or ESXI.

Unless the WBEMSharp team can prove me wrong.

You cannot connect to https://servername:5989/cimom directly.

Can any one confirm this?

0 Kudos
webwarrior
Contributor
Contributor

Got wbem-csharp working by changing quite a few lines of code.

Email me at prosoftnz at gmail dot com, if ou need info on this.

The attached code is higly customized to show only fans, power supplies, etc.

just remove the filters.

I also changed the code so that the properties of the instances shows up in the same place as the properties of the classes, instead of opening up 2 seperate forms, so the instances tab button actually becomes obsolute.

Also search for a piece of code that says Authorization="Basic .............................."

I found that in a packet that I sniffed when browsing the vsphere with the Java CIM Naviagtor.

Not sure what it should be changed to. maybe a hash algorythm of the root password?

Shaun O'Reilly

0 Kudos
harkamal
Expert
Expert

Hi Shaun,

Which namespace should I choose to get serial number ? OMC_Chasis throws exception.

Also, is it possible to not use root credentials for host connections ? and use the cim ticket instead ?

$h = Get-VMhost <myHost> | Get-View

$h.AcquireCimServicesTicket()

0 Kudos
bobqc
Contributor
Contributor

anyone can answer to the last post. Same problem for me (connection with ticket).

0 Kudos