Protection Domain Status Powershell | Nutanix Community
Skip to main content

Hi

I m working to automate the planned failover of protection domain. We are very familiar with powershell and so I m wondering what is the cmdlet to retrieve the status of protection domain (Enabled- in sync, disabled , pending ...) ?

I searched on the documentation but i didn’t find it

Thanks

Hello @Zarakas 

Here are some PS CMDLETS you can use to query your PD. 

Operations
• Add a snapshot schedule to a Protection Domain: Add-NTNXProtectionDomainCronSchedule
• Retrieve all snapshot schedules from a Protection Domain: GetNTNXProtectionDomainCronSchedule
• Remove a snapshot schedule from a Protection Domain: RemoveNTNXProtectionDomainCronSchedule
• Replace a snapshot schedule of a Protection Domain: ReplaceNTNXProtectionDomainCronSchedule

In the PDF Here You will find the complete method to install these CMD Lets and use them for several purposes.


Hi

Thanks for the reply. 

I have found already these cmdlets. But, when i promote a protection domain for a stretched cluster, i would like to get the status of it when it has been promoted to ensure the action is a success (Enabled in sync). i don’t find in any cmdlets a way to get this information.

Thanks

 

 


Hi Zarakas,

i don’t think there is a PS cmdlet that can get you the status (at least i couldn’t find it). 

Here is the Rest API call that would help you get the requested information:

"https://CVM_IP:9440/PrismGateway/services/rest/v2.0/protection_domains/<PD_NAME>" 

You’ll have to insert the IP address of one of the CVMs and put the PD name at the end.

You can use various tools to filter the output, i personally prefer jq. Here is an example:

curl -u "Admin:Pa$$w0rd" -sk "https://CVM_IP:9440/PrismGateway/services/rest/v2.0/protection_domains/sergei-metro"| jq .name,.metro_avail

"sergei-metro"

{

  "role": "Active",

  "remote_site": "Obelix",

  "storage_container": "sergei-test",

  "status": "Enabled",

  "failure_handling": "Manual"

}

Hope that it helps.