Extract metrics through the REST API
You can extract metrics from an ExtraHop system through the REST API to visualize metrics in a third-party tool or compare ExtraHop data with other data you have collected. To extract a metric, you must first get identifiers for both the metrics you want to extract and the objects you want to extract metrics for. You can then build and test a metric query in the REST API Explorer before incorporating your request into a script that can read the metrics into a format that can be imported into applications.
Before you begin
- You must log in to the ExtraHop system with an account that has unlimited privileges to generate an API key.
- You must have a valid API key to make changes through the REST API and complete the procedures below. (See Generate an API key.)
- Familiarize yourself with the ExtraHop REST API Guide to learn how to navigate the ExtraHop REST API Explorer.
Retrieve metric IDs
Metrics are identified in the ExtraHop REST API through a combination of the metric_category, the name, and the object_type. You can retrieve all three identifiers through the Metric Explorer.
Retrieve object IDs
Next, you must find the unique identifier for the object that you want to extract metrics for in the REST API. You can retrieve this ID through the REST API Explorer.
Important: | The REST API Explorer is not available on Reveal(x) 360. |
Query for metrics
You can query metrics through the REST API Explorer to make sure you have configured the right request body before adding the request to a script.
Important: | The REST API Explorer is not available on Reveal(x) 360. |
Retrieve and run the example Python script
The ExtraHop GitHub repository contains an example Python script that extracts the total count of HTTP responses a server with an ID of 1298 sent over five minute time intervals and then writes the values to a CSV file.
Important: | The example python script authenticates to the ExtraHop system through an API key, which is not compatible with the Reveal(x) 360 REST API. To run this script with Reveal(x) 360, you must modify the script to authenticate with API tokens. See the py_rx360_auth.py script in the ExtraHop GitHub repository for an example of how to authenticate with API tokens. |
Thank you for your feedback. Can we contact you to ask follow up questions?