We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – Install and Configure Telegraf on Ubuntu / Debian

Learn how to – Install and Configure Telegraf on Ubuntu / Debian.

Telegraf is an agent written in Go for collecting performance metrics from the system it’s running on and the services running on that system. The collected metrics are output to InfluxDB or other supported data stores. From InfluxDB, you should be able to visualize trends and systems performance using tools like Grafana.

A basic usage flow of Telegraf is:

  1. Telegraf agent is installed on all servers ( Ubuntu, Debian, Windows, CentOS e.t.c). It is the configured to collect metrics you want
  2. Metrics collected are pushed to InfluxDB
  3. InfluxDB data source is then added to Grafana
  4. Grafana Graphs are created – They get data from an influxdb data source

I recently covered the installation of Grafana and InfluxDB on Linux:

How to Install Telegraf on Ubuntu

Installation of telegraf on Ubuntu 18.04 is done from Influxdata repository. Once the repo is added, the package can then be installed using an apt package manager. Add the InfluxData repository to the file  /etc/apt/sources.list.d/influxdata.list

cat <<EOF | sudo tee /etc/apt/sources.list.d/influxdata.list
deb https://repos.influxdata.com/ubuntu $(lsb_release -cs) stable
EOF

Import apt key:

sudo curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -

Update apt index and install telegraf

sudo apt update

Install telegraf:

$ sudo apt install telegraf
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  telegraf
0 upgraded, 1 newly installed, 0 to remove and 70 not upgraded.
Need to get 38.5 MB of archives.
After this operation, 144 MB of additional disk space will be used.
Get:1 https://repos.influxdata.com/ubuntu focal/stable amd64 telegraf amd64 1.22.1-1 [38.5 MB]
Fetched 38.5 MB in 1s (40.3 MB/s)
Selecting previously unselected package telegraf.
(Reading database ... 141706 files and directories currently installed.)
Preparing to unpack .../telegraf_1.22.1-1_amd64.deb ...
Unpacking telegraf (1.22.1-1) ...
Setting up telegraf (1.22.1-1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/telegraf.service → /lib/systemd/system/telegraf.service.

Start and enable the service to start on boot up.

$ sudo systemctl enable --now telegraf
$ sudo systemctl is-enabled telegraf
enabled

Check service status:

$ systemctl status telegraf
* telegraf.service - The plugin-driven server agent for reporting metrics into InfluxDB
   Loaded: loaded (/lib/systemd/system/telegraf.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2019-01-30 04:03:11 PST; 2min 54s ago
     Docs: https://github.com/influxdata/telegraf
 Main PID: 3385 (telegraf)
    Tasks: 11 (limit: 1110)
   CGroup: /system.slice/telegraf.service
           `-3385 /usr/bin/telegraf -config /etc/telegraf/telegraf.conf --config-directory /etc/telegraf/telegraf.d
....

Install Telegraf on Debian

Add Influx Data repository using the following command:

cat <<EOF | sudo tee /etc/apt/sources.list.d/influxdata.list
deb https://repos.influxdata.com/debian $(lsb_release -cs) stable
EOF

Import repo gpg key for installing signed packages:

sudo curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -

Update apt index and install telegraf package:

sudo apt update
sudo apt install telegraf

Start telegraf service:

sudo systemctl enable --now start telegraf

You can check the status to confirm if running using:

sudo systemctl status telegraf

Configuring Telegraf

Now that you have InfluxDB and Telegraf running, you can go through our guide on how to Monitor Linux System with Grafana and Telegraf to learn how to configure Telegraf and use it with Grafana.

Cart

Your Cart is Empty

Back To Shop