Get started with Telegraf

This page documents an earlier version of Telegraf. Telegraf v1.26 is the latest stable version.

Use Telegraf to collect and write metrics into InfluxDB and other supported outputs.

To get up and running, do the following:

  1. Download and install Telegraf
  2. Configure Telegraf
  3. Start Telegraf service

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.

Configure Telegraf

Configuration file location by installation type

  • macOS Homebrew: /usr/local/etc/telegraf.conf
  • Linux debian and RPM packages: /etc/telegraf/telegraf.conf
  • Standalone Binary: see the next section for how to create a configuration file

Note: You can also specify a remote URL endpoint to pull a configuration file from. See Configuration file locations.

Create and edit the configuration file

Before starting the Telegraf server, create or edit the initial configuration to specify your inputs (where the metrics come from) and outputs (where the metrics go). You can do this several ways.

You can use Telegraf to generate a configuration file for you, you can run the following command to get a complete sample config called telegraf.conf with all possible plugins.

telegraf --sample-config > telegraf.conf

You can simplify this config by specifying which plugins you want to use with the filter flags. For example you can specify two inputs (cpu and mem) with the --input-filter flag and specify InfluxDB as the output with the --output-filter flag.

telegraf --sample-config --input-filter cpu:mem --output-filter influxdb_v2 > telegraf.conf

The resulting config will have cpu and mem reading metrics about the system’s cpu usage and memory usage, and then output this data to InfluxDB. Note that after running the following command, the output plugin influxdb_v2 will still need to be configured with your url, orginization and bucket.

The resulting config file will also contain all available aggegators and processors, you can filter them out as well like so:

telegraf --sample-config --input-filter cpu:mem --output-filter influxdb_v2 --aggregator-filter : --processor-filter : > telegraf.conf

Learn more about the possible commands and flags in this document.

Start Telegraf service

Start the Telegraf service and direct it to the relevant configuration file or URL to pull a configuration file from a remote endpoint:

macOS Homebrew

telegraf --config telegraf.conf

Linux (sysvinit and upstart installations)

sudo service telegraf start

Linux (systemd installations)

systemctl start telegraf


Telegraf starts collecting and writing data to the specified output.

Returning to our sample configuration, we show what the cpu and mem data looks like in InfluxDB below. Note that we used the default input and output configuration settings to get this data.

name: measurements
name: cpu
fieldKey                fieldType
usage_guest             float
usage_guest_nice	       float
usage_idle		            float
usage_iowait		          float
usage_irq		             float
usage_nice		            float
usage_softirq		         float
usage_steal		           float
usage_system		          float
usage_user		            float

name: mem
fieldKey                fieldType
active			               integer
available		             integer
available_percent	      float
buffered		              integer
cached			               integer
free			                 integer
inactive		              integer
total			                integer
used			                 integer
used_percent		          float
  • Select a sample of the data in the field usage_idle in the measurement cpu_usage_idle:
> SELECT usage_idle FROM cpu WHERE cpu = 'cpu-total' LIMIT 5
name: cpu
time			               usage_idle
2016-01-16T00:03:00Z	 97.56189047261816
2016-01-16T00:03:10Z	 97.76305923519121
2016-01-16T00:03:20Z	 97.32533433320835
2016-01-16T00:03:30Z	 95.68857785553611
2016-01-16T00:03:40Z	 98.63715928982245

Notice that the timestamps occur at rounded ten second intervals (that is, :00, :10, :20, and so on) - this is a configurable setting.

That’s it! You ready to use Telegraf to collect metrics and write them to your output of choice.

For an introduction to Telegraf and an overview of how it works, watch the following videos:

Was this page helpful?

Thank you for your feedback!

Linux Package Signing Key Rotation

All signed InfluxData Linux packages have been resigned with an updated key. If using Linux, you may need to update your package configuration to continue to download and verify InfluxData software packages.

For more information, see the Linux Package Signing Key Rotation blog post.

State of the InfluxDB Cloud (IOx) documentation

The new documentation for InfluxDB Cloud backed by InfluxDB IOx is a work in progress. We are adding new information and content almost daily. Thank you for your patience!

If there is specific information you’re looking for, please submit a documentation issue.