Solved

Access denied trying to retrieve snapshot information

  • 28 July 2020
  • 5 replies
  • 1668 views

I’m receiving a 401 Unauthorized error when trying to access our cluster to retrieve snapstop information. I’m passing a valid VM UUID and have used credentials from one of our local user accounts which has both cluster and admin roles assigned. I can access most other methods of the API using these credentials, but not this one. What am I doing wrong?

https://{prism_element_ip}:9440/api/nutanix/v2.0/flr/{vm_uuid}/snapshots

icon

Best answer by Sergei Ivanov 28 July 2020, 19:10

View original

This topic has been closed for comments

5 replies

Userlevel 4
Badge +5

Hi seanwithin,

the URL seems a bit strange to me. I can get the snapshots by using this URL:

https://{prism_element_ip}:9440/PrismGateway/services/rest/v2.0/snapshots/?vm_uuid={vm_uuid}

Does it work with that one?

That is definitely different! I’m new to using the Nutanix API and didn’t know that the URL needed “PrismGateway/services/rest” in it. But it made me realize that I’m not looking for VM snapshots, but actually Local Snapshots for Entities in Data Protection. When I used your URL with a specific VM that i know has Local Snapshots in Data Protection the API returned with 0 entities found.

I guess I should explain that what I’m ultimately trying to do is to be able to see changes in cluster storage per VM (including any type of snapshot related to the VM), image, etc. I’m looking for a way to account for all of the storage usage to make sure that day over day, nothing is growing beyond normal means without us knowing about it.

Userlevel 4
Badge +5

I think you can get the usage of snapshots this way:

$ curl -u "Admin:Pa$$w0rd" -sk "https://{prism_element_ip}:9440/PrismGateway/services/rest/v2.0/protection_domains/{Protection_domain_name}" | jq .name,.usage_stats
"Protection_domain_name"
{
"lws_store_used_bytes": "0",
"dr.exclusive_snapshot_usage_bytes": "5311942656",
"hydration_space_bytes": "-1"
}

that means that the protection domain’s snapshot space usage is 5311942656 bytes, which is 4.94Gb. If i go to Prism - Data Protection, i see the same amount there.

I recommend to explore the Rest API options with the Rest API explorer that is built into Prism. You can click on the user name in Prism and then go to the Rest API explorer from there.

Great, thanks for the suggestion about the API explorer! That’ll be very helpful. 

Do you have any suggestions as to where all I’ll need to look to find all objects on the cluster that consume storage space?

Userlevel 4
Badge +5

I think you will have to check components individually as i don’t think there is a place where all storage consumers are put together. I know that some people write their own scripts for such tasks, but i don’t have such a script. Maybe somebody else will share here.