6.0

Table Of Contents
vSphere SDK for Perl Programming Guide
10 VMware, Inc.
SampleScriptsScriptsthatyoucancustomizeforyourneedsandthatillustratethevSphereSDKfor
Perlsfunctionality.YoumustknowPerltocustomizethescripts.Unliketheutilityapplications,sample
scriptsarenotsupportedbyVMware.
AvSphereSDKforPerlinstallationalsoincludesthefollowinglibraries:
WebServicesforManagementPerlLibraryandExamplesTheWSManagementPerlLibraryallows
youtowritescriptsthatretrieveCIMdatafromtheESXihostusingCIMOM,aservicethatprovides
standardCIMmanagementfunctionsoveraWBEM(WebBasedEnterpriseManagement).See“Web
ServicesforManagementPerlLibrary”
onpage 51.
CredentialStoreLibraryandExamplesAllowsvSphereSDKforPerlapplicationstomanagethe
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 13,“OptionsAvailableforAll
SDKforPerlCommands,”onpage 16foracompletelistofconnectionparameters.
IfyouwanttousetheSDKforataskthatnoneoftheutilityapplicationscanperform,youmightperformthe
following
tasks:
1Checkthe/samplesfolderforasamplescriptthatperformsasimilartask.Thescriptsinthesamples
folderareavailableforcustomization.
2Ifascriptthatperformsasimilartaskisavailable,modifythescript.Ifnoneofthescriptsissuitable,write
anewscriptusingthe
vSphereSDKforPerlsubroutines.
Thefollowingmaterialsareavailableformodifyingorwritingscripts:
NOTEIfyoucannotfindautilityapplication,examinethesamplescripts.Youcanusesamplescriptsas
startingpointsforyourapplication.OnLinux,/usr/share/doc/vmware-vcli/samples,onWindows,
Program Files\VMware\VMware vSphere CLI\Perl\samples.Samplescriptsarenotsupported.