Automation

 View Only
  • 1.  SRM status and fault detail

    Posted Sep 14, 2022 10:12 PM

    Working on a script to show SRM protection status of VMs.

    I adapted the basic code from here to add more detail.
    https://vdc-download.vmware.com/vmwb-repository/dcr-public/847b8d79-9752-43d3-8217-8270ab647679/1e992a3d-ac47-4453-8182-457145215c40/GUID-95273F92-CAE5-45F4-9DE9-E8C20B022185.html

    Here's my code. All seems to be working except if there is a fault, the Faults column shows {VMware.Vim.LocalizedMethodFault} instead of what the fault is. I can't figure out how to expand this to show fault details.

     

     

     



  • 2.  RE: SRM status and fault detail

    Posted Sep 14, 2022 10:45 PM

    Here's a hackish variation that shows the contents of $error.exception. In my example, the code below shows the error as:

    "The object 'vim.VirtualMachine:vm-363' has already been deleted or has not been completely created"

     

    The SRM mgmt page shows protection status as:

    "Invalid: Virtual machine 'SERVER01' is no longer protected. VM 'SERVER01' is not replicated by VR. Protected VM deleted."

    I'd like to capture that detail message if possible.

     

     

     

     



  • 3.  RE: SRM status and fault detail

    Posted Sep 22, 2022 04:25 PM

    For your Faults, line, try the following:

     

    I haven't been able to test this myself (couldn't find faults to test against in SRM), but referencing the properties for vim.vim.LocalizedMethod.Fault led me to the dataobject reference as having a property localizedMessage - type string.