Getting started with Telegraf

Getting started with Telegraf

Telegraf is an agent written in Go for collecting metrics and writing them into InfluxDB or other possible outputs.
This guide will get you up and running with Telegraf.
It walks you through the download, installation, and configuration processes, and it shows how to use Telegraf to get data into InfluxDB.

Download and install Telegraf

Follow the instructions in the Telegraf section on the Downloads page.

Note: Telegraf will start automatically using the default configuration when installed from a deb package.

Configuring Telegraf

Configuration file location by installation type

Standalone Binary: see the next section for how to create a configuration file

Creating and editing the configuration file

Before starting the Telegraf server you need to edit and/or create an initial configuration that specifies your desired inputs (where the metrics come from) and outputs (where the metrics go). There are several ways to create and edit the configuration file.
Here, we’ll generate a configuration file and simultaneously specify the desired inputs with the -input-filter flag and the desired output with the -output-filter flag.

In the example below, we create a configuration file called telegraf.conf with two inputs:
one that reads metrics about the system’s cpu usage (cpu) and one that reads metrics about the system’s memory usage (mem). We specify InfluxDB as the desired output.