> For the complete documentation index, see [llms.txt](https://platform9.com/kb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://platform9.com/kb/pmo/how-to/obtain-compute-hosts-hypervisor-info-using-api.md).

# Obtain Compute Hosts/Hypervisor Info Using API

## Problem

A user would like to use the OpenStack API to obtain information about Hosts/Hypervisors in OpenStack environment, such as current CPU usage/allocation, Memory usage/allocation, Storage usage/allocation, etc, similar to what is shown in the Clarity UI.

## Environment

* Platform9 Managed OpenStack - v3.6.0 and Higher

## Procedure

1. The following **`curl`** command using your Management Plane's Nova API endpoint can be used to get the details of a hypervisor in Platform9 Managed OpenStack.

{% tabs %}
{% tab title="None" %}

```none
$ curl -s -H "X-Auth-Token: $TOKEN" https://[Management Plane FQDN]/nova/v2.1/[project id]/os-hypervisors/detail |jq '.[][]'
```

{% endtab %}
{% endtabs %}

The above will list all the details of all the hypervisors in the environment. 2. One can apply **`jq`** filters to obtain the required information from the list of hypervisors.

{% tabs %}
{% tab title="None" %}

```none
$ curl -s -H "X-Auth-Token: $TOKEN" https://[Management Plane FQDN]/nova/v2.1/[project id]/os-hypervisors/detail |jq '.[][]| { cpu_information: .cpu_info, hostname: .hypervisor_hostname, Memory_Used: .memory_mb_used,Free_RAM: .free_ram_mb, Free_Disk: .free_disk_gb, CPU_util: .["OS-EXT-PF9-HYP-RES"].cpu_util_percent }'
```

{% endtab %}
{% endtabs %}

## Additional Information

One can get the TOKEN and \[Project Id] to be used in the command mentioned above by running the following command.

{% tabs %}
{% tab title="None" %}

```none
$ openstack token issue
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://platform9.com/kb/pmo/how-to/obtain-compute-hosts-hypervisor-info-using-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
