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);
}
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
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
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
Thanks Ryan. I will review the samples.
Thanks again for your help.
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