(Last Updated On: March 8, 2019)

Question: How to install telegraf on RHEL 8 / CentOS 8?. Telegraf is a powerful monitoring agent used for collecting and reporting performance metrics from the system it is running on. It is part of TICK Stack. The metrics collected by Telegraf can be saved in a time-series database such as InfluxDB or any other supported data store.

Features of Telegraf

Here are the key features of Telegraf metrics collector.

  • Has small memory footprint – the power of Go
  • Being written in Go. It compiles into a single binary with no external dependencies.
  • It is plugin-driven to allow easy addition of new inputs and outputs
  • Supports InfluxDB, Graphite, OpenTSDB, Datadog, Librato, Kafka, MQTT, NSQ, and many other datastores.

Install Telegraf on RHEL 8 / CentOS 8

As of this writing, there is no official repository for RHEL 8 but we will use InfluxData repository for RHEL 7 which works fine.

Update your system RHEL 8 system.

sudo yum -y update

Step 1: Add Influxdata RPM repository

Then add Influxdata RPM repository.

cat <<EOF | sudo tee /etc/yum.repos.d/influxdb.repo
[influxdb]
name = InfluxDB Repository - RHEL 
baseurl = https://repos.influxdata.com/rhel/7/x86_64/stable/
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key
EOF

Step 2: Install Telegraf on RHEL 8 / CentOS 8

Once the repository has been added, install Telegraf on RHEL 8 using the command below.

$ sudo dnf -y install telegraf

Updating Subscription Management repositories.
Updating Subscription Management repositories.
bintray--sbt-rpm                           731  B/s | 1.3 kB     00:01    
bintray--sbt-rpm                           6.8 kB/s |  12 kB     00:01    
Red Hat Enterprise Linux 8 for x86_64 - Ap 1.6 kB/s | 4.1 kB     00:02    
Red Hat Enterprise Linux 8 for x86_64 - Ba 3.2 kB/s | 4.1 kB     00:01    
Dependencies resolved.
===========================================================================
 Package          Arch           Version            Repository        Size
===========================================================================
Installing:
 telegraf         x86_64         1.10.0-1           influxdb          17 M

Transaction Summary
===========================================================================
Install  1 Package

Total download size: 17 M
Installed size: 60 M
Downloading Packages:
telegraf-1.10.0-1.x86_64.rpm               1.2 MB/s |  17 MB     00:14    
---------------------------------------------------------------------------
Total                                      1.2 MB/s |  17 MB     00:14     
warning: /var/cache/dnf/influxdb-5468cd5ca80e07dd/packages/telegraf-1.10.0-1.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 2582e0c5: NOKEY
InfluxDB Repository - RHEL                 5.1 kB/s | 3.0 kB     00:00    
Importing GPG key 0x2582E0C5:
 Userid     : "InfluxDB Packaging Service <[email protected]>"
 Fingerprint: 05CE 1508 5FC0 9D18 E99E FB22 684A 14CF 2582 E0C5
 From       : https://repos.influxdata.com/influxdb.key
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                   1/1 
Installed: telegraf-1.10.0-1.x86_64
  Running scriptlet: telegraf-1.10.0-1.x86_64                          1/1 
  Installing       : telegraf-1.10.0-1.x86_64                          1/1 
  Running scriptlet: telegraf-1.10.0-1.x86_64                          1/1 
Created symlink /etc/systemd/system/multi-user.target.wants/telegraf.service → /usr/lib/systemd/system/telegraf.service.

Installed: telegraf-1.10.0-1.x86_64
  Verifying        : telegraf-1.10.0-1.x86_64                          1/1 

Installed:
  telegraf-1.10.0-1.x86_64                                                 

Complete!

You can view package details with rpm command.

$ rpm -qi telegraf
Name : telegraf
Version : 1.10.0
Release : 1
Architecture: x86_64
Install Date: Fri 08 Mar 2019 09:09:52 PM EAT
Group : default
Size : 62601198
License : MIT
Signature : RSA/SHA256, Tue 05 Mar 2019 11:51:34 PM EAT, Key ID 684a14cf2582e0c5
Source RPM : telegraf-1.10.0-1.src.rpm
Build Date : Tue 05 Mar 2019 10:30:24 PM EAT
Build Host : ef84cdc475e1
Relocations : /
Packager : [email protected]
Vendor : InfluxData
URL : https://github.com/influxdata/telegraf
Summary : Plugin-driven server agent for reporting metrics into InfluxDB.
Description :
Plugin-driven server agent for reporting metrics into InfluxDB.

Step 3: Start and Configure Telegraf Service on RHEL 8 / CentOS 8

Now that telegraf is installed on RHEL 8, let’s start the service and enable it to start on boot.

sudo systemctl enable --now telegraf

Confirm status.

$ systemctl status telegraf
● telegraf.service - The plugin-driven server agent for reporting metrics into InfluxDB
Loaded: loaded (/usr/lib/systemd/system/telegraf.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2019-03-08 21:26:12 EAT; 5s ago
Docs: https://github.com/influxdata/telegraf
Main PID: 1906 (telegraf)
Tasks: 10 (limit: 11510)
Memory: 15.7M
CGroup: /system.slice/telegraf.service
└─1906 /usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d
Mar 08 21:26:12 rhe8.local systemd[1]: Started The plugin-driven server agent for reporting metrics into InfluxDB.
Mar 08 21:26:12 rhe8.local telegraf[1906]: 2019-03-08T18:26:12Z I! Starting Telegraf 1.10.0
Mar 08 21:26:12 rhe8.local telegraf[1906]: 2019-03-08T18:26:12Z I! Loaded inputs: processes swap system cpu disk diskio kernel mem
Mar 08 21:26:12 rhe8.local telegraf[1906]: 2019-03-08T18:26:12Z I! Loaded aggregators:
Mar 08 21:26:12 rhe8.local telegraf[1906]: 2019-03-08T18:26:12Z I! Loaded processors:
Mar 08 21:26:12 rhe8.local telegraf[1906]: 2019-03-08T18:26:12Z I! Loaded outputs: influxdb
Mar 08 21:26:12 rhe8.local telegraf[1906]: 2019-03-08T18:26:12Z I! Tags enabled: host=rhe8.local
Mar 08 21:26:12 rhe8.local telegraf[1906]: 2019-03-08T18:26:12Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"rhe8.local", Flush Interval:10s
Mar 08 21:26:12 rhe8.local telegraf[1906]: 2019-03-08T18:26:12Z W! [outputs.influxdb] when writing to [http://localhost:8086]: database "" creation fa>

Step 4: Configure Telegraf on RHEL 8 / CentOS 8

Follow our guide below to see example on configuration of Telegraf.

Monitor Linux System with Grafana and Telegraf

For Telegraf and Grafana installation, use the links below.

How to Install Grafana on RHEL 8

How to Install InfluxDB on RHEL 8 / CentOS 8

Related articles:

Monitoring Ceph Cluster with Prometheus and Grafana

How to Monitor Redis Server with Prometheus and Grafana in 5 minutes

How to Monitor Linux Server Performance with Prometheus and Grafana in 5 minutes

How to Monitor BIND DNS server with Prometheus and Grafana

Monitoring MySQL / MariaDB with Prometheus in five minutes

How to Monitor Apache Web Server with Prometheus and Grafana in 5 minutes