Press "Enter" to skip to content

Getting All Zerto Info v6

Joshua Stenhouse 0

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

 

 

 

 

 

Leave a Reply

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

%d bloggers like this: