Perl Interface to vCenter


Here at Penn State we have some legacy Perl code that creates an inventory of VMs to display to users who are not logged into vSphere client. We are using a custom Perl module (named VM55.pm) to connect to vCenter.  Our VM55.pm Perl module uses the VIMRuntime.pm, VIRuntime.pm, VICommon.pm and VILib.pm modules.  

We need to add some recently created vSphere Custom Attributes, aka properties, to our VM55.pm code so we can display the new Custom Attributes on the user interface pages.  Here is an example from our VM55.pm code of how we are successfully getting some of the existing properties from vCenter: 

$customPropertiesHash{"config.hardware.numCoresPerSocket"} = "";
$customPropertiesHash{"config.hardware.device"} = "";
$customPropertiesHash{"config.cpuAllocation.shares.shares"} = "";
$customPropertiesHash{"config.annotation"} = "";                             ##This string works correctly to get the old backup data listed in the "Notes" section of the properties. 

My question is, what is the wording and syntax of the string data that denotes the new custom attributes string data?  I need to get the Last Backup date information.  Below I show some of my attempts that have not worked: 

#$customPropertiesHash{"config.customFields"} = ""; 
#$customPropertiesHash{"config.custom.fields"} = "";
#$customPropertiesHash{"config.customAttributes"} = "";
#$customPropertiesHash{"config.customFields.lastBackup"} = "";  

I can run a script in PowerCLI to get the properties from vCenter as shown below, including the Last Backup data:

"Name": "deploy-test-c864",
"CustomFields": "[Application/Service, ] [Backup, ] [Backup Status, Backup Job ID [111282] Client: [vcenter.blue.psu.edu], Backup Set: [defaultBackupSet], Subclient: [Zone-A] Parent Backup Job ID [108449]] [Budget Owner, ] [ClusterInvariantVMMId, ] [Customer, ] [Fixing Contact, ] [Last Backup, 4/25/2022 7:55:28 AM] [OS, ] [OS Patched, ] [Production Level, ] [Server Type, ] [Technical Contacts, ] [VRM Owner, ] [vrmManagedMachine, ]"

I am going to try other strings such as "config.customAttributes.lastBackup", "summary.customFields.lastBackup", "summary.config.customFields.lastBackup" and so on.  This is not a very efficient process to find the correct string data.  

I would greatly appreciate any help or opinions in this matter. 

Thank you, 

Tad Rimmey

Penn State University

0 Kudos
0 Replies