6.0
Table Of Contents
- vSphere SDK for Perl Programming Guide
- Contents
- Getting Started with vSphere SDK for Perl
- Writing vSphere SDK for Perl Scripts
- Refining vSphere SDK for Perl Scripts
- Creating and Using Filters
- Filtering Views Selectively Using Properties
- Retrieving the ServiceInstance Object on a vSphere Host
- Saving and Using Sessions
- Using Multiple Sessions
- Learning About Object Structure Using Data::Dumper
- Specifying Untyped Arguments in Scheduled Tasks and Callbacks
- Using Advanced Subroutines
- vSphere SDK for Perl Subroutine Reference
- Web Services for Management Perl Library
- Credential Store Perl Library
vSphere SDK for Perl Programming Guide
10 VMware, Inc.
SampleScripts–ScriptsthatyoucancustomizeforyourneedsandthatillustratethevSphereSDKfor
Perl’sfunctionality.YoumustknowPerltocustomizethescripts.Unliketheutilityapplications,sample
scriptsarenotsupportedbyVMware.
AvSphereSDKforPerlinstallationalsoincludesthefollowinglibraries:
WebServicesforManagementPerlLibraryandExamples–TheWS‐ManagementPerlLibraryallows
youtowritescriptsthatretrieveCIMdatafromtheESXihostusingCIMOM,aservicethatprovides
standardCIMmanagementfunctionsoveraWBEM(Web‐BasedEnterpriseManagement).See“Web
ServicesforManagementPerlLibrary”
onpage 51.
CredentialStoreLibraryandExamples–AllowsvSphereSDKforPerlapplicationstomanagethe
vSpherecredentialstore.ThecredentialstoreallowsvSphereSDKforPerlscriptstoauthenticate
themselvestoESX/ESXiorvCenterServersystems.See“CredentialStorePerlLibrary”onpage 61.
vCLICommands‐SetofhostmanagementcommandsandasetofDCLIcommandsformanaging
vCenterservices.
Using vSphere SDK for Perl
ThissectionexplainshowtogetstartedwithvSphereSDKforPerlbylookingattwotypicalusagescenarios.
ItalsolistscommonvSphereSDKforPerltasksanddiscussesprogrammingconventions.
Getting Started
IfyouwanttousetheSDKtoretrieveperformanceinformationforahost,youmightperformthefollowing
tasks:
1CheckthevSphereSDKforPerlUtilityApplicationsReferenceortheappsdirectoryforascriptthatretrieves
performanceinformation.
Check/usr/lib/vmware-vcli/appsonLinuxand
Program Files\VMware vSphere CLI\Perl\apps
onWindows.Allutilityapplicationsarefullysupported.
Theviperformance.plscriptretrievesperformancecountersfromthehost.
2Runthescriptwiththe--helpoptionorwithoutanyoptionstoseeitsonlinedocumentation.More
detailedinformationisintheUtilityApplicationsReferenceincludedinthevSphereSDKforPerl
documentation
setandavailablefromtheVMwareWebsite.
3Runtheviperformance.plscriptagainstanESXihost.
viperformance.pl --url https://<host>:<port>/sdk/vimService --username nemo --password fi\$h
--host Aquarium --countertype net --interval 30 --samples 3
Escapecharactersmustprecedespecialcharactersinpasswords.SeeTable 1‐3,“OptionsAvailableforAll
SDKforPerlCommands,”onpage 16foracompletelistofconnectionparameters.
IfyouwanttousetheSDKforataskthatnoneoftheutilityapplicationscanperform,youmightperformthe
following
tasks:
1Checkthe/samplesfolderforasamplescriptthatperformsasimilartask.Thescriptsinthesamples
folderareavailableforcustomization.
2Ifascriptthatperformsasimilartaskisavailable,modifythescript.Ifnoneofthescriptsissuitable,write
anewscriptusingthe
vSphereSDKforPerlsubroutines.
Thefollowingmaterialsareavailableformodifyingorwritingscripts:
NOTEIfyoucannotfindautilityapplication,examinethesamplescripts.Youcanusesamplescriptsas
startingpointsforyourapplication.OnLinux,/usr/share/doc/vmware-vcli/samples,onWindows,
Program Files\VMware\VMware vSphere CLI\Perl\samples.Samplescriptsarenotsupported.