Get Time Series Data

Get Time Series Data
Gets time-series data points for a given resource type and resource identifiers

Gets time-series metrics data for a given resource_type and resource_id. Use the /key-info API to check which keys have 'is_time_series' set to 'true'. It can be used to fetch raw metrics and aggregated metrics for metrics keys. A distinct metric is defined by a combination of resource_type, site_id, node_id, resource_id, obj_id, and metric_key. Only a few metric keys support query time aggregation. Use the /key-info API to check which keys have aggregate_by_resource_ids set to 'true'.

Request
URI
POST
https://{api_host}/metrics/data
COPY
Request Body

Metrics data request body. Contains a list of NSX Resource Intent Paths or UUIDs (for NSX objects without intents), resource type, time interval, and other parameters.

MetricsDataRequest of type(s) application/json
Required
This request body class requires all of the following: InlineMetricsDataRequest0 , InlineMetricsDataRequest1
{
    "granularity": "string",
    "start_time": 0,
    "end_time": 0,
    "keys": [
        "string"
    ],
    "resource_type": "string",
    "resource_ids": [
        "string"
    ],
    "related_metrics_request": {
        "conditions": [
            {
                "related_resource_type": "string",
                "related_resource_ids": [
                    "string"
                ],
                "metrics_condition_conjunction": "string"
            }
        ],
        "metrics_condition_conjunction": "string"
    },
    "aggregate_resource_ids": false,
    "aggregate_operation": "string",
    "max_num_data_points": 0,
    "object_ids": [
        "string"
    ],
    "node_ids": [
        "string"
    ],
    "site_ids": [
        "string"
    ],
    "page_number": 0,
    "page_size": 0,
    "filter": {
        "filter_components": [
            {
                "filter_field": "string",
                "filter_operation": "string",
                "value": "string",
                "metrics_key": "string"
            }
        ],
        "metrics_condition_conjunction": "string"
    },
    "aggregation": {
        "aggregation_dimension": "string",
        "aggregation_function": "string"
    },
    "groupby": "string",
    "include_partial_intervals": false
}
Authentication
This operation uses the following authentication methods.
Responses
200

OK

Returns MetricsDataResponse of type(s) application/json
{
    "start_time": 0,
    "end_time": 0,
    "granularity": "string",
    "resource_type": "string",
    "is_status_metric": false,
    "page_number": 0,
    "page_size": 0,
    "total_results": 0,
    "results": [
        {
            "resource_id": "string",
            "resource_ref_id": "string",
            "related_entries": [
                {
                    "related_resource_type": "string",
                    "related_resource_entities": [
                        {
                            "related_resource_id": "string",
                            "related_resource_ref_id": "string",
                            "related_resource_display_name": "string"
                        }
                    ]
                }
            ],
            "site_id": "string",
            "display_name": "string",
            "key_results": [
                {
                    "key": "string",
                    "unit": "string",
                    "description": "string",
                    "results": [
                        {
                            "object_id": "string",
                            "node_id": "string",
                            "node_path": "string",
                            "node_name": "string",
                            "last_known_status": {
                                "time": 0,
                                "value": "string",
                                "is_partial": false
                            },
                            "data": [
                                {
                                    "time": 0,
                                    "value": "string",
                                    "is_partial": false
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ]
}
integer As int64 As int64
start_time
Optional

Epoch time in milliseconds. Actual start time of the data being reported.

integer As int64 As int64
end_time
Optional

Epoch time in milliseconds. Actual end time of the data being reported.

string
granularity
Optional

Granularity of the metrics data required. Defaults are based on the following settings:

  • If time-range is <= 12 hours, the default is 5-minute granularity.
  • If time-range is > 12 hours and <= 7 days, the default is 1-hour granularity.
  • If time-range is more than 7 days, the default is 1-day granularity. If you are looking for a coarser value, use this field. For example, if ONE_HOUR is set, the system will aggregate all the data points available within one hour and return the aggregated metric value. This field is not relevant (and is ignored) for "is_status" metrics.
Possible values are : FIVE_MINUTES, ONE_HOUR, ONE_DAY,
string
resource_type
Optional

This is a required field. Resource Type for which metric keys and their information is requested for. Examples of supported NSX resource types are PolicyEdgeNode, HostTransportNode, Tier0Interface, Tier1Interface, Tier0, Tier1, Rule, SegmentPort. Examples of supported (Security Services Platform) resource_types are SspCluster, SspNode and various SSP Services.

boolean
is_status_metric
Optional

Set to 'true' when the response is for 'is_status_metric' keys. For these types of metrics, do not expect to see periodic data points. These are reported or plotted only when the value of such metrics changes or transitions. If there are no transitions to report in the requested interval (defined by start_time - end_time), 'data' will be empty, and the latest status can be retrieved from 'last_known_value'.

integer As int32 As int32
page_number
Optional

Current page number of the response.

integer As int32 As int32
page_size
Optional

Maximum number of results in the response.

integer As int32 As int32
total_results
Optional

Total count of results for the request.

array of object
results
Optional

Collection of per resource metric results.


default

Error Response

Returns Error of type(s) application/json
{
    "error_code": 0,
    "module_name": "string",
    "error_message": "string"
}
integer
error_code
Required

HTTP Status or Application error code.

string
module_name
Optional

Module where the error happened.

string
error_message
Required

Message describing the error.


Code Samples
COPY
                    curl -X POST -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '{"keys":["string"],"resource_type:"string"}' https://{api_host}/metrics/data