Nutanix with ESXi API output | Nutanix Community
Skip to main content
Solved

Nutanix with ESXi API output


Forum|alt.badge.img
  • Adventurer
  • 3 replies

Hi everyone, I need some help.

I'd like to see the output of several Prism Element API calls in the Nutanix/ESXi hypervizor environment.

curl -ks -u 'user:pass' -X GET 'https://<prism_element_ip>:9440/PrismGateway/services/rest/v2.0/cluster'
curl -ks -u 'user:pass' -X GET 'https://<prism_element_ip>:9440/PrismGateway/services/rest/v2.0/hosts'
curl -ks -u 'user:pass' -X GET 'https://<prism_element_ip>:9440/PrismGateway/services/rest/v2.0/vms?include_vm_disk_config=true&include_vm_nic_config=true'

We are developing a monitoring/reporting tool for multiple platforms. We have recently added support for Nutanix as well. It works fine with AHV but we don't have access to a Nutanix/ESXi config.

Thanks and regards,

P.

Best answer by AnishWalia20

API v3 is currently not supported on ESXi clusters, whereas API v2 works just fine and are exactly the same as it works on AHV clusters. 

 

Below are some of the useful links:

  1) for the VM: https://www.nutanix.dev/reference/prism_element/v2/api/vms/get-vms-getvms/

2) Cluster: https://www.nutanix.dev/reference/prism_element/v2/api/cluster/get-cluster-getclusterinfo/

3) Hosts: https://www.nutanix.dev/reference/prism_element/v2/api/hosts/get-hosts-gethosts/


All this can be found here: https://www.nutanix.dev/reference/prism_element/v2/api

View original
Did this topic help you find an answer to your question?
This topic has been closed for comments

6 replies

AnishWalia20
Nutanix Employee
Forum|alt.badge.img+5
  • Nutanix Employee
  • 201 replies
  • July 31, 2020

Hey @PeWu , as fat as I know the above REST API v2 actions are not supported on ESXi clusters.

Allow me some time to look into and search for the above and get back to you.:sweat_smile:

Also in the mean time here is the REST API v2 documentation https://www.nutanix.dev/reference/prism_element/v2/topics/introduction/  so that you can have a look, if not already.


Forum|alt.badge.img
  • Author
  • Adventurer
  • 3 replies
  • July 31, 2020

Thanks, that would be great.

I hope there is some other way to get VM details, in case these API actions are not available for ESXi…

 


AnishWalia20
Nutanix Employee
Forum|alt.badge.img+5
  • Nutanix Employee
  • 201 replies
  • July 31, 2020

@PeWu So I researched internally and I found out that REST APIs v2 is supported on ESXi clusters. Also the above should work as well. I think there can be some issue communicating with the Prism Interface.

Can you try this and check if you can connect to the Prism gateway port using the PE IP of ESXi cluster:
 

nc -zv <PE_IP> 9440

 

Can you send me the output of below as you have issues with multiple endpoints:

curl -ks -u 'user:pass' -X GET 'https://<prism_element_ip>:9440/'

 

 


Forum|alt.badge.img
  • Author
  • Adventurer
  • 3 replies
  • July 31, 2020

@AnishWalia20 I think you misunderstood my request :-)

I don’t have access to Nutanix/ESXi environement. So far we have developed and tested our tool on a nested NCE with AHV.

That’s why I would appreciate if anyone could provide us with outputs from a Nutanix/ESXi environment.


AnishWalia20
Nutanix Employee
Forum|alt.badge.img+5
  • Nutanix Employee
  • 201 replies
  • July 31, 2020

Ahh @PeWu got it. My bad I misread:smile:

 

Give me some time so I will try the above out on a test cluster and let you know.


AnishWalia20
Nutanix Employee
Forum|alt.badge.img+5
  • Nutanix Employee
  • 201 replies
  • Answer
  • August 26, 2020

API v3 is currently not supported on ESXi clusters, whereas API v2 works just fine and are exactly the same as it works on AHV clusters. 

 

Below are some of the useful links:

  1) for the VM: https://www.nutanix.dev/reference/prism_element/v2/api/vms/get-vms-getvms/

2) Cluster: https://www.nutanix.dev/reference/prism_element/v2/api/cluster/get-cluster-getclusterinfo/

3) Hosts: https://www.nutanix.dev/reference/prism_element/v2/api/hosts/get-hosts-gethosts/


All this can be found here: https://www.nutanix.dev/reference/prism_element/v2/api