Documentation

Install Telegraf

This page provides directions for installing, starting, and configuring Telegraf. To install Telegraf, do the following:

Requirements

Installation of the Telegraf package may require root or administrator privileges to complete successfully.

Networking

Telegraf offers multiple service input plugins that may require custom ports. Modify port mappings through the configuration file (telegraf.conf).

For Linux distributions, this file is located at /etc/telegraf for default installations.

For Windows distributions, the configuration file is located in the directory where you unzipped the Telegraf ZIP archive. The default location is C:\InfluxData\telegraf.

NTP

Telegraf uses a host’s local time in UTC to assign timestamps to data. Use the Network Time Protocol (NTP) to synchronize time between hosts. If hosts’ clocks aren’t synchronized with NTP, the timestamps on the data might be inaccurate.

Download and install Telegraf

Recommended:: Before you open and install packages and downloaded files, use SHA checksum verification and GPG signature verification to ensure the files are intact and authentic.

SHA checksum and GPG signature verification are complementary checks.

For some Linux platforms, the installation instructions include steps to verify downloaded packages and binaries.

For more information, see the following:

Verify download integrity using SHA-256

Verify file integrity and authenticity using GPG

To learn how to manually install the RPM package from a file, see the downloads page.

To use the yum package manager to install the latest stable version of Telegraf, follow these steps:

  1. In your terminal, enter the following command to add the InfluxData repository to the yum configuration:

    cat <<EOF | sudo tee /etc/yum.repos.d/influxdata.repo
    [influxdata]
    name = InfluxData Repository - Stable
    baseurl = https://repos.influxdata.com/stable/$basearch/main
    enabled = 1
    gpgcheck = 1
    gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-influxdata
    EOF
    
    • Copy
    • Fill window
  2. Enter the following command to install telegraf from the repository.

    sudo yum install telegraf
    
    • Copy
    • Fill window

The telegraf configuration file is installed at /etc/telegraf/telegraf.conf.

Generate a configuration file

The telegraf config command lets you generate a configuration file from Telegraf’s plugin list.

Create a configuration file with default input and output plugins

To generate a configuration file with default input and output plugins enabled, enter the following command in your terminal:

telegraf config > telegraf.conf
  • Copy
  • Fill window
.\telegraf.exe config > telegraf.conf
  • Copy
  • Fill window

Create a configuration file with specific input and output plugins

To generate a configuration file that contains settings for only specific plugins, use the --input-filter and --output-filter options to specify input plugins and output plugins–for example:

telegraf \
--input-filter 
cpu
:
http
\
--output-filter
influxdb_v2
:
file
\
config > telegraf.conf
  • Copy
  • Fill window
.\telegraf.exe `
--input-filter 
cpu
:
http
`
--output-filter
influxdb_v2
:
file
`
config > telegraf.conf
  • Copy
  • Fill window

For more advanced configuration details, see the configuration documentation.

Custom-compile Telegraf

Use the Telegraf custom builder tool to compile Telegraf with only the plugins you need and reduce the Telegraf binary size.

  1. Prerequisites
  2. Build the custom builder tool
  3. Run the custom builder to create a telegraf binary

Prerequisites

Build the custom builder tool

  1. Clone the Telegraf repository and then change into the repository directory–for example, enter the following command in your terminal:

    git clone https://github.com/influxdata/telegraf.git && cd ./telegraf
    
    • Copy
    • Fill window
  2. To build the Telegraf custom builder tool, enter the following command:

    make build_tools
    
    • Copy
    • Fill window

Run the custom builder to create a telegraf binary

The custom builder builds a telegraf binary with only the plugins included in the specified configuration files or directories.

Run the custom_builder tool with at least one --config or --config-directory flag to specify Telegraf configuration files to build from.

  • --config: accepts local file paths and URLs.
  • --config-dir: accepts local directory paths.

You can include multiple --config and --config-dir flags.

Examples

Single Telegraf configuration
./tools/custom_builder/custom_builder --config /etc/telegraf.conf
  • Copy
  • Fill window
Single Telegraf configuration and Telegraf configuration directory
./tools/custom_builder/custom_builder \
--config /etc/telegraf.conf \
--config-dir /etc/telegraf/telegraf.d
  • Copy
  • Fill window
Remote Telegraf configuration
./tools/custom_builder/custom_builder \
--config http://url-to-remote-telegraf/telegraf.conf
  • Copy
  • Fill window

After a successful build, you can view your customized telegraf binary within the top level of your Telegraf repository.

Update your custom binary

To add or remove plugins from your customized Telegraf build, edit your configuration file, and then run the custom builder to regenerate the Telegraf binary.


Was this page helpful?

Thank you for your feedback!


The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Read more

InfluxDB 3 Core and Enterprise are now in Beta

InfluxDB 3 Core and Enterprise are now available for beta testing, available under MIT or Apache 2 license.

InfluxDB 3 Core is a high-speed, recent-data engine that collects and processes data in real-time, while persisting it to local disk or object storage. InfluxDB 3 Enterprise is a commercial product that builds on Core’s foundation, adding high availability, read replicas, enhanced security, and data compaction for faster queries. A free tier of InfluxDB 3 Enterprise will also be available for at-home, non-commercial use for hobbyists to get the full historical time series database set of capabilities.

For more information, check out: