Metrics are supported on virtualservice, serviceengine, pool, server, virtualmachine, and host objects.

All metrics API have the following syntax:

https://${controller}/api/analytics/metrics/ ${object_type}/${object_uuid}/?metric_id=${metric_id}& ${additional_kv_options}

By default, APIs use tenant admin. In order to perform queries for a specific non admin tenant, add HTTP header X-AVI-TENANT. When the X-AVI-TENANT header is specified, the user access is checked against that tenant before analytics APIs are served.

For example, use the following API to query metricsl4_client.avg_bandwidth, l7_client.avg_complete_responses for the virtual service virtualservice-abc at intervals of five minutes and for the past 6 hours (72 samples):

https://avicontroller/api/analytics/metrics/ virtualservice/virtualservice-abc/?metric_id=l4_client.avg_bandwidth, l7_client.avg_complete_responses&limit=72&step=300

Of all the options, limit, step, start and stop work together. step denotes the duration granularity of the metrics aggregation. For example, step=300 means the average, sum, max etc. are computed using metrics in a duration window of five minutes.

The metrics API returns one value every five minutes as denoted by step. The NSX Advanced Load Balancer solution supports step up to 300,3600,86400 values. When start and stop are not specified, stop is assumed to be the latest time in UTC and start is computed using the formula: stop - limit * step. When only start and step are specified, the solution computes the limit based on the formula: (stop - start) / step, to return all the metrics available starting from time = start.

For more information on retrieving metrics through API, see Metrics API.

For information on configuration steps for metrics collection, see Metrics Collection.

Using API for retrieving metrics

1. Get metrics for last 6hrs: limit=72 & step=300.

2. Get metrics for last 1day: limit=288 & step=300.

3. Get metrics since T1: start=T1 & step=300.

4. Get latest single metric: limit=1 & step=300.