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
24 VMware, Inc.
Found HostSystem: abcd-42.shellfish.vmware.com
Understanding Server-Side Objects
WhenyourunavSphereSDKforPerlscript,yourgoalistoaccessandpotentiallyanalyzeormodify
server‐sideobjects.YouneedthenameofthevSphereAPIobjectsandoftentheirpropertiesandmethod
names.Forexample,ifyouwanttopoweroffavirtualmachine,youmust
knowhowtofindthecorresponding
object,whatthenameofthepoweroffmethodis,andhowtorunthatmethod.
ThevSphereAPIReferenceGuidegivesreferencedocumentationforallvSphereAPIobjects.Someusersmight
alsofindthevSphereWebServicesSDKProgrammer’sGuidehelpfulforunderstandinghow
thevSphereAPI
objectsinteract.TheguidesareavailablefromtheVMwareAPIsandSDKsDocumentationpage.
ThissectionfirstintroducestheManagedObjectBrowser(MOB),whichallowsyoutobrowseallobjectsona
remotehost.Therestofthesectiondiscusseshowtoworkwiththeseserver‐sideobjects.
Youlearnhowtofind
theobjects,accessandmodifyproperties,andhowtorunamethodontheserver.
Use the Managed Object Browser to Explore Server-Side Objects
TheMOBisaWeb‐basedserverapplicationhostedonallESX/ESXiandvCenterServersystems.TheMOBlets
youexploretheobjectsonthesystemandobtaininformationaboutavailablepropertiesandmethods.Itisa
usefultoolforinvestigatingserver‐sideobjectsandforlearningaboutthevSphereobject
model.
InESXi6.0andlater,theMOBisdisabledbydefaultonESXi.
To enable the MOB on ESXi 6.0 and later systems
1 SelectthehostinthevSphereWebClientandgotoAdvancedSystemSettings.
2FindConfig.HostAgent.plugins.solo.enableMobandenabletheMOB.
WhileapasswordisrequiredtoaccesstheMOB,considerthesecurityimplicationsofenabling
it.
To access the MOB on any ESXi or vCenter Server system
1StartaWebbrowser.
2 ConnecttotheMOBusingthefully‐qualifieddomainname(ortheIPaddress)oftheESX/ESXiorvCenter
Serversystem,asfollows:
https://<hostname.yourcompany.com>/mob
Thebrowserpromptsyouforausernameandpasswordforthehost.
3Entertheusernameandpassword.
Afteryouentertheusernameandpassword,thehostmightdisplaywarningmessagesregardingtheSSL
certificateauthority,suchasWebsite Certified by an Unknown Authority.IfVMwareisthe
certificateauthority,youcandisregardsuch
warningsandcontinuetologintotheMOB.
WhenyouaresuccessfullyconnectedtotheMOB,thebrowserdisplaysthemanagedobjectreferenceforthe
service(ManagedObjectReference:ServiceInstance),availableproperties(withvalues),andmethods,as
showninFigure 2‐1.