Querying Last9 using HTTP API
How to query metrics from Last9 using HTTP API
This step-by-step guide explains how to query Last9 using HTTP API.
Last9 Read URL
Create a Last9 cluster by following Getting Started. Each Last9 Cluster comes with a Read URL which needs to be used when querying metrics data from Last9.
You can grab the Read URL by going to the Last9 Cluster → Settings → Read Data → Bring Your Own Visualization.
Keep the following information handy after creating the Last9 cluster:
$levitate_read_url
- Last9’s Read endpoint$levitate_username
- Cluster ID$levitate_password
- Read token created for the cluster
Authentication
Generate the authorization header for authenticated access to Last9 metrics API as follows.
Instant Query
The simplest way to query Last9 is to use $levitate_read_url
along with $AUTH_HEADER
, which allows you to execute an instant query.
Example:
Query the current CPU usage:
Range Query
Use the query_range
endpoint to retrieve data over a time range. You need to specify the start time, end time, and step duration.
Example:
Query CPU usage over the last hour with a 1-minute step:
Troubleshooting
Please get in touch with us on Discord or Email if you have any questions.