Solved

Collect Nutanix PD Snapshot

  • 7 April 2021
  • 6 replies
  • 260 views

Badge

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.

 

icon

Best answer by JacksonWrath1607 10 April 2021, 09:42

View original

This topic has been closed for comments

6 replies

Userlevel 6
Badge +16

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

Badge

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...

Userlevel 1
Badge +1

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.

Userlevel 1
Badge +1

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>).usageStats["dr.exclusive_snapshot_usage_bytes"]

 

Badge

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>).usageStats["dr.exclusive_snapshot_usage_bytes"]

 

Many Thanks !

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

Badge

Superb i have it ! :). Many thanks :D.