Before you can use the Metrics API to retrieve virtual machine or edge gateway metrics from your environment, you must know the ID of the target object (virtual data center, virtual machine, or edge gateway).

1

Log in to vCloud Air. See Log in to vCloud Air for information.

2

Create a login session with vCloud Director. See Create a Session for a Virtual Data Center in a Service for information.

Using the vCloud API, query vCloud Director for the ID of an edge gateway, virtual data center, or virtual machine for which you require metrics:

GET https://vcloud.example.com/api/query?type=edgeGateway&format=idrecords

GET https://vcloud.example.com/api/query?type=adminOrgVdc&format=idrecords

GET https://vcloud.example.com/api/query?type=Vm&format=idrecords

For more information, see Typed Queries in the vCloud API Programmer's Guide.

Note

Alternatively, you can use thevCloud API to navigate the vCloud Director Organization and virtual data center to obtain these IDs. After logging in and creating a session, the vCloud Air API returns the VCloudSessionType object.

The VCloudSessionType object represents a reference to a virtual data center on the vCloud instance. The virtual data center reference contains the full URL to the vCloud instance so that you can log in and navigate the Organization corresponding to the VDCReference. The returned virtual data center contains a list of all its gateways.