HTTP integration
You can send custom metrics through various data collectors/aggregators.
Data format
The format of a payload looks like this:
name: Description and namespace for the metric.
tags: Key/Value string pairs and usually used to identify the metric.
fields: Key/Value pairs that are typed and usually contain the metric data.
timestamp: Date and time associated with the fields.
Serialization
An example of it in JSON serialization looks like the one you sent in the Getting started tutorial:
{
"name": "tutorial",
"timestamp": 1628044399,
"tags": {
"color": "red"
},
"fields": {
"cpu": 12.66
}
}
We are actively adding new serialization formats.
Endpoint
Send them as POST requests to https://ingest.terrastruct.com
with your API key as the authorization header:
Authorization
Authorization: Bearer <api-token>
You can find your API token by going into the HTTP integration modal.


HTTP integration


API key
Open source collectors
One of the most popular open-source data collectors out there is Telegraf.
The easiest way to get started with Telegraf is to start sending CPU readings from a machine.
- Install it here for the platform of the machine you want to collect data from.
- Download or copy the contents of this gist. It is a configuration template that'll tell Telegraf to collect CPU data every 10s and send to Terrastruct in JSON. Don't forget to replace the API key with your own.
Telegraf configuration
You can view the full configuration for Telegraf here.
- Run Telegraf with the configurations from (2). Platform-specific instructions for running Telegraf found here.
- Explore the various plugins that let you collect more than CPU data. For example, Telegraf has a Statsd input plugin that lets your application metrics to be sent via Statsd to Terrastruct (example config here).
With that, you should start to see metrics streaming in from Telegraf!
Updated 9 months ago