VMware Cloud Community
raavidotkishore
Contributor
Contributor

VMware vSphere PowerCLI alternative

Hi All,

I had to develop an application that gets ESXi Server performance metrics like CPU usage, memory, network, disk read/write, etc.

I know a solution for this using VMware vSphere PowerCLI (vmware.vim.dll), the problem is every user have to download and install PowerCLI in order to use my application.

Is there any alternative solution solution for this? so that I can re-write my application wihtout using PowerCLI?

Thanks,

Kishore

ZENQA

sample code when we use Power CLI

VimClient

client = new VimClient();

client.Login("https://10.10.1.1/sdk", @"test\admin", "password");

NameValueCollection filter = new NameValueCollection();

IList<EntityViewBase> esxList =  client.FindEntityViews(typeof(HostSystem), null, null, null);

foreach (HostSystem host in esxList)

{

string hostname =  host.Name.ToString();

string version =  host.Summary.Config.Product.FullName.ToString();

MessageBox.Show(hostname);

MessageBox.Show(version);

}

0 Kudos
5 Replies
RyanMcL
Enthusiast
Enthusiast

You could use c# with the SDK.

or

You could setup a server with a share that runs your script(s) on a schedule and dumps the output in html format to the shre for the users to access

or

You could setup IIS/Apache and serve the output of your scripts via a webpage (maybe use accessing the page as a trigger for the script to run if the last run was more than 10min ago)

I realise that the last two are not desktop apps but they are possible alternatives.

Regards,

Ryan

raavidotkishore
Contributor
Contributor

HI Ryan,

thanks for the Quick response.

could you provide me some sample code or usefull links for "You could use c# with the SDK."

Thanks,

Kishore

0 Kudos
RyanMcL
Enthusiast
Enthusiast

I can't give sample code as I haven't delved into the depths of the SDK with c#.

But I would start here:

http://www.vmware.com/support/developer/vsphere_mgmt_sdk/index.html

There are samples in the download as well as the documentation.

Hope that helps.


Ryan

raavidotkishore
Contributor
Contributor

Thanks Ryan. I will review the samples.

Thanks again for your help.

0 Kudos
LucD
Leadership
Leadership

There are indeed samples in the Web Services.

This StackOverflow post has some good pointers how to use this with C# from Visual Studio 2010 and in vSphere 5.

For you performance data assignment you can have a look at my Datastore usage statistics post.

You could use the Get-Stat2 function as a prototype for using the QueryPerf method.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos