Deploying Telegraf on Linux

<< Deploying InfluxDB in Docker

Telegraf is an open source server agent to help you collect metrics from your stacks, sensors and systems.

In this guide series we will be using Telegraf as our main data collection agent. To get started we first need to install Telegraf on your Linux host.

This guide was created with Telegraf v1.13.0!

# BASH [Linux VM]
sudo wget && sudo dpkg -i telegraf_1.13.0-1_amd64.deb

After installing, the Telegraf service starts by default which means we need to stop it to configure Telegraf.

# BASH [Linux VM]
sudo systemctl stop telegraf.service

Rename the default telegraf.conf file located in /etc/telegraf/.

# BASH [Linux VM]
sudo mv /etc/telegraf/telegraf.conf /etc/telegraf/old-telegraf.conf

Download the telegraf.conf example file from my Gist and set the file permissions for it.

# BASH [Linux VM]
sudo curl -o /etc/telegraf/telegraf.conf && sudo chmod 0644 /etc/telegraf/telegraf.conf && sudo chown root:root /etc/telegraf/telegraf.conf

Copy the basic inputs file into /etc/telegraf/telegraf.d.

# BASH [Linux VM]
sudo curl -o /etc/telegraf/telegraf.d/system_inputs.conf && sudo chmod 0644 /etc/telegraf/telegraf.d/system_inputs.conf && sudo chown root:root /etc/telegraf/telegraf.d/system_inputs.conf

You will need to edit the telegraf.conf file via nano as the example file does not include any info for your environment! nano /etc/telegraf/telegraf.conf and edit the [[outputs.influxdb]] section!

After we are done editing we can test our config.

# BASH [Linux VM]
cd /etc/telegraf/ && telegraf --test --config-directory /etc/telegraf/telegraf.d/

Now restart the Telegraf service so the new config takes effect.

# BASH [Linux VM]
sudo systemctl start telegraf && sudo systemctl status telegraf