Press "Enter" to skip to content

Getting All Zerto Info v6

Joshua Stenhouse 8

Using PowerShell to get data from REST APIs is usually straightforward once you’ve got a good example to work from. There are however some exceptions where the REST API might not work in the way you expect, and Zerto Virtual Protection Groups (VPGs) are a perfect example of this. In this post, I’m going to give you an example of how to get all the settings from a VPG plus everything else I can think of.

The status, RPO, VM count, priority, storage usage, and last test info are all easily obtained using GET /v1/vpgs. But if you want all the detailed settings from boot groups, default datastores, journal and network settings, you must go deeper.

ZVMEditVPG

The trick with getting detailed VPG info is that you cannot just query an endpoint with a VPG ID. The Zerto VPG REST API works in the same way as the GUI in that the only way to see the detailed settings is to edit the VPG. Programmatically this means you must select the VPG ID, POST a JSON request to edit the VPG and it returns a VPG settings ID. Armed with the VPG settings ID a GET to /v1/vpgSettings/{VPGSettingsID} will give you all the data you need, which you can combine with other REST API calls in order to translate IDs into meaningful object names.

Even though you’re not editing the VPG, this is the only way to get the advanced VPG settings and you don’t actually have to make any changes (just like the GUI). If this sounds really complicated I promise it’s not once you’ve got an example, which you can download from the below link:

ZertoInfov6.zip

I created 2 versions, one for PowerShell 5.x and another for 6.x. Extract it to C:\ZertoInfov6\, edit the $ZertoServer variable with your ZVM IP/Hostname, run the script, and you’ll be prompted for your Zerto credentials. Within a couple minutes the following CSV files will be created:

ZertoInfov6Output

I also included all the vSphere information that your ZVM is tracking, so it’s literally everything I could think of from datastores and resource pools to VM NICs and VRAs.

If you found this useful follow me on twitter for updates on new content. Or, if you think of more information you’d like adding give me a shout on my Drift chatbot. Happy scripting,

Joshua

 

 

 

 

 

  1. Gordon Howes Gordon Howes

    Thanks very much for this, When you say Zerto credentials, what do you mean exactly. I’ve tried the vsphere creds as well as the local admin of the ZVM server and both come back with “Not authenticated with Zerto”

  2. jason jason

    that is an awesome script

  3. This has just saved me hours of scripting errors and frustration. Thank you so much for this awesome script

  4. edtoner edtoner

    Excellent – I could not figure out how to get to the vpg settings in the api

    • Joshua Stenhouse Joshua Stenhouse

      Thank you. I can’t believe it still works!

    • Joshua Stenhouse Joshua Stenhouse

      Thank you. I can’t believe it still works!

      • if you could get this in a wrapper like rvtools, it would be freaking awesome!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Virtually Sober

Subscribe now to keep reading and get access to the full archive.

Continue reading