VMware Programming API

101001101

Weaksauce
Joined
Aug 8, 2013
Messages
69
Hi guys

Quick question, has anyone got any experience with the VMware programming API or similar?

I'm looking to experiment with this and wondered what mechanism I can plug into that VMware provide which will allow me to extract VM resource details, for example say I have VM1 (Linux VM ofc ;) ) and I wish to pull off an inventory of its virtual resources (number of vCPUs, RAM, HDD, NICs and associated VMware Network, resource reservations applied to that specific VM and if it is a member of a resource pool) periodically - can this be done without having to log into vCenter / vSphere Client (using code of some sort, not a GUI)?

It must be scripted remotely (using any language) or more preferred via Python / Perl / PHP etc.

What do you think?

Thanks
 
Thanks I'll check out the Perl implementation first and if it doesn't match my requirements go for PowerCLI.

Cheers guys!
 
I suggest powerCLI simply because so much of it is easy to search for.
Java and Perl does exist but you'll find less examples on the net.

I store some of my larger code on a Wordpress site.
Http://pcli.me

Nick Farmer
 
Hi Nick

Thanks - I do use PowerCLI for some basic tasks but to be honest I've not studied it in depth, this is a good excuse and I know I'm missing out if I don't! Thanks for linking up your code, that is much appreciated! I will take a look.

What I'm trying to do is what I mentioned above, build a screen that provides an overview of a VM or collection of VM's, so for example if the resource reservation is modified by an admin elsewhere - I want to know about it immediately, so its kind of a basic monitoring tool for my use. I don't know if PowerCLI can provide that detail on a single / collection of VMs.
 
333:

You can do everything with powershell, powerCLI is just an add on for your vcenter collection. With some ninja Addons and SSH embedded in your powershell scripts it can even go after your Linux servers.

I've created a software suite that is 50+ powershell scripts that dump its output into a SQL database. I then have a DotNet website that uses a combination of powershell and that database to give me everything in a magical format.

I've been told by countless people i need to package it and sell it. Even Virtu-al was impressed when he saw it.

Some day it will get finished and published as a suite or a fling but for now, I try to help the community when I can.

So, long story shorter.... You can do a simple inventory snap shot on a scheduled cycle. Store that data in something simple as a csv file or as big as a database. You can then run a second script to compare that inventory between your existing and your historic.
A ton of "report" scripts exist out there. See if you can find one that pulls what you need and if you have any questions, throw it on here and I'm sure someone will answer back.

Nick
Http://pcli.me
 
Thanks Nick - what you have built sounds particularly awesome and perhaps you should listen to your friends and package it up and sell it! why not? but the problem is that this platform would not be relying on Windows as its source OS, I want it to run on Linux? I do not want the overhead that Windows provides and costs.
 
Something that was announced at vmworld:
The 5.5 web client has a fling out soon that let's you run powercli commands in the web browser.
Full powershell looking window too.
So, if you can launch a web browser on your Linux machine you could still use that.

You could also stand up a windows 7 box to hold all of your scripts and powershell API calls.

I fully understand the push away from windows. If I could transition to the Perl API faster than building a win7 vm I would make the switch.

Nick
 
Look into PowerGUI and the community VMware pack. It already has a bunch of the scripts built out for you.
 
Back
Top