VMware {code} Community
k_3
Contributor
Contributor
Jump to solution

getting started with the perl api?

Hi,

I'm after a pointer or two in the right direction to get started with the perl api for vmware - I've read around and have ended up not sure about which api I should be using. The ESX environment is v2.5.

My requirement is to collect performance data from the VM guests (cpu/mem/disk/net) and some configuration data (disk to lun map/mem & cpu allocations etc). I'm saying this only in case it affects the selection of API.

I have also seen some docs/sample scripts that mention a list of attributes that can come from the guest - are these documented completely somewhere just in case I need more later?

I've seen talk of vSphere cli for perl 4.0 (sounds odd as perl is 5.x now), also version 1.5 and 1.6 of the perl api. VIX too. I'm guessing vmware have been changing names as they develop the products, but since I'm at VC 2.5 I'm sure sure at which point in the lifecycle I should be at. If there is a readme that explains this lot just let me know.

Thanks in advance.

0 Kudos
1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager
Jump to solution

First off, definitely take a look at this page: http://communities.vmware.com/community/developer/forums/vsphere_sdk_perl at the Resources section on the right.

This is a great document showing you the details of how the perl toolkit no redubbed vSphere SDK for Perl, definitely worthwhile to go through the documentation:

http://www.vmware.com/support/developer/viperltoolkit/doc/perl_toolkit_appliance_idx.html

If you're familiar with the esxcfg-* commands, then you'll notice as part of the vCLI/RCLI which utilizes the vSphere SDK for Perl has the same exact command set but setup to help do remote management:

http://engr.ucsb.edu/~duonglt/vmware/#vmware_rcli

http://engr.ucsb.edu/~duonglt/vmware/#vmware_vcli

There are some additional utilities that come bundled with the vCLI/RCLI as well, take a look here for the list:

http://engr.ucsb.edu/~duonglt/vmware/#vmware_viptk

As you know, these are all Perl scripts, meaning you can open them up and see how it's implemented and how they use the vSphere API, the reference doc for the API is also very important too:

vSphere 4.0 - http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/index.html

VI 3.5 - http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/index.html

I think the easiest way to learn this is to start playing with some of the canned scripts and to make it even easier to have an environment that's all setup for you with both the vCLI and vSphere SDK for Perl, you can download the vMA which is a VMware management assistant appliance for remotely managing your ESX(i) and vCenter systems.

The version of Perl that's being used is actually 1.6 but the naming of vCLI is 4.0 which is in conjunction with vSphere 4.0 release, it has nothing to do with the version of Perl (yes the naming/numbering really sucks and confuses a lot of people)

Here is a nice document that does the breakdown of all the various APIs/SDKs/etc. :

VIX is primary for guest management, it's to be used or can be used in conjunction with the vSphere API's and you can find more information on the VIX page.

Also here is some sample code for vSphere SDK for Perl: http://communities.vmware.com/community/developer/codecentral/vsphere_perl and

Well, I'm sure this is a handful of information and it'll take some time to digest, but again the best way to learn is to start to play with it and you'll get a hang for it.

Good luck and happy scripting Smiley Happy

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

View solution in original post

0 Kudos
2 Replies
lamw
Community Manager
Community Manager
Jump to solution

First off, definitely take a look at this page: http://communities.vmware.com/community/developer/forums/vsphere_sdk_perl at the Resources section on the right.

This is a great document showing you the details of how the perl toolkit no redubbed vSphere SDK for Perl, definitely worthwhile to go through the documentation:

http://www.vmware.com/support/developer/viperltoolkit/doc/perl_toolkit_appliance_idx.html

If you're familiar with the esxcfg-* commands, then you'll notice as part of the vCLI/RCLI which utilizes the vSphere SDK for Perl has the same exact command set but setup to help do remote management:

http://engr.ucsb.edu/~duonglt/vmware/#vmware_rcli

http://engr.ucsb.edu/~duonglt/vmware/#vmware_vcli

There are some additional utilities that come bundled with the vCLI/RCLI as well, take a look here for the list:

http://engr.ucsb.edu/~duonglt/vmware/#vmware_viptk

As you know, these are all Perl scripts, meaning you can open them up and see how it's implemented and how they use the vSphere API, the reference doc for the API is also very important too:

vSphere 4.0 - http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/index.html

VI 3.5 - http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/index.html

I think the easiest way to learn this is to start playing with some of the canned scripts and to make it even easier to have an environment that's all setup for you with both the vCLI and vSphere SDK for Perl, you can download the vMA which is a VMware management assistant appliance for remotely managing your ESX(i) and vCenter systems.

The version of Perl that's being used is actually 1.6 but the naming of vCLI is 4.0 which is in conjunction with vSphere 4.0 release, it has nothing to do with the version of Perl (yes the naming/numbering really sucks and confuses a lot of people)

Here is a nice document that does the breakdown of all the various APIs/SDKs/etc. :

VIX is primary for guest management, it's to be used or can be used in conjunction with the vSphere API's and you can find more information on the VIX page.

Also here is some sample code for vSphere SDK for Perl: http://communities.vmware.com/community/developer/codecentral/vsphere_perl and

Well, I'm sure this is a handful of information and it'll take some time to digest, but again the best way to learn is to start to play with it and you'll get a hang for it.

Good luck and happy scripting Smiley Happy

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
k_3
Contributor
Contributor
Jump to solution

er - wow - that's just what I needed.

A little reading to catch up on though - but loads clearer!

Ta

0 Kudos