Collect Nutanix PD Snapshot | Nutanix Community
Skip to main content

Hello everyone, 

After some research i saw that there is no opportunities to collect Total Snapshot Usage (Exclusive Usage) per Protection Domain through the API (i’m on 5.15.3 AOS).

As i have lot of VMs per PD, how can i collect this info through Nutanix Cmdlets and obtain this one per PD ? 

 

Thanks.

 

If it’s not possible via API there is even less change to get it by cmdlets. There is a 2 part guide on snapshot here on forum maybe you find something usefull: Part 1 part 2


Hello ! Thanks for the reply.

 

I have 3 PD and i tried the following script :

$NutanixSnapTotalSize = 0
$NutanixSnapList = Get-NTNXProtectionDomainSnapshot


Foreach($NutanixSnap in $NutanixSnapList) { 
$NutanixSnapTotalSize = $NutanixSnapTotalSize + $NutanixSnap.exclusiveUsageInBytes
}
$NutanixSnapTotalSize

 

If i connect on prism console for all my PD i saw more in average 800 Go on Snapshot Exclusive Usage in Total but by script i saw only 46 Go i don’t understand why...


The Prism Element API (the v2 one) does have this stat, under the /protection-domains/{name} endpoint. There’s a “usage_stats” object towards the bottom of the response that has “dr.exclusive_snapshot_usage_bytes”

https://www.nutanix.dev/reference/prism_element/v2/api/protection-domains/get-protection-domains-name-getprotectiondomainbyname

I’m not sure if the cmdlets have this stat though.

On your second question, you can’t sum up snapshot usage like that. Each snapshot only reports the amount of data it’s exclusively using (i.e. if you deleted only that snapshot, that’s how much space it would free). The catch is that there’s usually data that multiple snapshots are relying on; since that’s not “exclusive” to any one snapshot, none of them will report it, but the total number in the PD will reflect it.


Follow up:

I installed the cmdlets and it is indeed there! Just a bit hidden. It shows up if you add the “-ExpandedOutput” parameter to the “Get-NTNXProtectionDomain” cmdlet. This will give you the number you want in PowerShell:

(Get-NTNXProtectionDomain -PdName <PD_NAME_HERE>).usageStatsa"dr.exclusive_snapshot_usage_bytes"]

 


Follow up:

I installed the cmdlets and it is indeed there! Just a bit hidden. It shows up if you add the “-ExpandedOutput” parameter to the “Get-NTNXProtectionDomain” cmdlet. This will give you the number you want in PowerShell:

(Get-NTNXProtectionDomain -PdName <PD_NAME_HERE>).usageStatsa"dr.exclusive_snapshot_usage_bytes"]

 

Many Thanks !

I’ll check today and reply back for my case 🙂.


Superb i have it ! 🙂. Many thanks 😃.