Telegraf

Send Telegraf metrics with the http output and the JSON format. You need a source's ingest token (Getting started); metrics use the same token as logs.

2 min read

On this page4 sections

1. Add the config#

Save this as tailcove.conf in Telegraf's config folder (any .conf file in it is read), with your token in place of YOUR_SOURCE_TOKEN. The folder is /etc/telegraf/telegraf.d on Linux, $(brew --prefix)/etc/telegraf.d with Homebrew on a Mac, and C:\Program Files\Telegraf\telegraf.d on Windows (create it if it isn't there):

[[inputs.cpu]]
  percpu = false
  totalcpu = true

[[inputs.mem]]

[[inputs.disk]]

[[outputs.http]]
  url = "https://ingest.tailcove.dev/api/v1/metrics"
  method = "POST"
  data_format = "json"
  [outputs.http.headers]
    Authorization = "Bearer YOUR_SOURCE_TOKEN"
    Content-Type = "application/json"

Each field becomes a point named measurement.field (for example cpu.usage_idle), tags become labels, and the host tag becomes the host.

2. Check it, then restart Telegraf#

telegraf --config /etc/telegraf/telegraf.conf --config-directory /etc/telegraf/telegraf.d --test
sudo systemctl restart telegraf
telegraf --config "$(brew --prefix)/etc/telegraf.conf" --config-directory "$(brew --prefix)/etc/telegraf.d" --test
brew services restart telegraf
# Run PowerShell as Administrator, in C:\Program Files\Telegraf.
.\telegraf.exe --config telegraf.conf --config-directory telegraf.d --test
Restart-Service telegraf

On Windows, Telegraf runs as a service only once it's installed as one, with the folder passed in: .\telegraf.exe --service install --config "C:\Program Files\Telegraf\telegraf.conf" --config-directory "C:\Program Files\Telegraf\telegraf.d".

--test reads the inputs once and prints the points without sending anything, so a typo shows up before the restart.

3. See the points#

Open the source's Metrics tab and pick a metric such as cpu.usage_idle. The first points appear within one flush interval (10 seconds by default).

If nothing shows up#

journalctl -u telegraf -n 50 shows what the http output got back:

  • 401: the token is wrong or was rotated. Copy the current one from the source.
  • 429: the plan's points per minute or the monthly quota is reached; Telegraf retries the batch. Fewer inputs or a longer interval lower the rate.
  • over_series_limit above 0 in a 202 answer: the source has more distinct series than the plan allows (100 on Free), so new ones are dropped. Keep percpu = false, and drop inputs or tags you do not chart.

Limits and every response code: Metrics.

Still stuck?

Email us and we will help you get it working.

Contact support