How To Install Telegraf on centOS 8

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

Telegraf is a plugin-driven server agent for collecting and sending metrics and events from databases, systems, and IoT sensors.

Telegraf is written in Go and compiles into a single binary with no external dependencies, and requires a very minimal memory footprint.

–Influxdata.com

Install Telegraf on centOS 8

first update centOS 8 system

sudo dnf update

there are 2 ways to install Telegraf on system manually and using yum package manager

step 1. Add Influxdata RPM repository:

Telegraf is created by influxDB organisation, if we configured influx DB repository we can install both applications.

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

command to install and run telegraf service

sudo yum install telegraf
sudo systemctl start telegraf
  1. Download and import InfluxData’s public key:
curl -sL https://repos.influxdata.com/influxdb.key | gpg --import

2.Download the signature file for the release by adding .asc to the download URL.

wget https://dl.influxdata.com/telegraf/releases/telegraf-1.14.1_linux_amd64.tar.gz.asc

3. Verify the signature with gpg --verify

gpg --verify telegraf-1.14.1_linux_amd64.tar.gz.asc telegraf-1.14.1_linux_amd64.tar.gz

Telegraf configuration

All plugins are available in configuration file , most of them are commented , we need to uncomment and use them.

the default locations are /etc/telegraf/telegraf.conf for the main configuration file and /etc/telegraf/telegraf.d for the directory of configuration files.

you can create your own telegraf confguration file with current configuration using below command. you can make modification in it as use it as per your requirement.below command will create new configuration file in current working directory.

telegraf config > telegraf.conf

if you want to create configuration file with specific inputs and outputs , run below command.

telegraf –input-filter <pluginname>[:<pluginname>] –output-filter <outputname>[:<outputname>] config > telegraf.conf

set Evironment variables

 we can set Telegraf environment variables in this file (/etc/default/telegraf):

USER="alice"
INFLUX_URL="https://us-west-2-1.aws.cloud2.influxdata.com" INFLUX_SKIP_DATABASE_CREATION="true"
INFLUX_PASSWORD="monkey123"

Global Tags :

can be specified in[global_tags] section of the config file in key="value" format.

Input configuration:

config parameter to set in INPUT section

  • interval: How often to gather this metric.
  • name_override: Override the base name of the measurement. (Default is the name of the input).
  • name_prefix: Specifies a prefix to attach to the measurement name.
  • name_suffix: Specifies a suffix to attach to the measurement name.
  • tags: A map of tags to apply to a specific input’s measurements.
# INPUTS
[[inputs.cpu]]
percpu = true
totalcpu = false
# filter all fields beginning with 'time_'
fielddrop = ["time_*"]

same way we can configure.

OUTPUT configuration

Aggregator configuration

Processor configuraton

you can get all information about all avialable telegraf plugins and other information about telegraf from below location

https://github.com/influxdata/telegraf

Thanks,

Please visit related topics.

https://unixcop.com/how-to-install-and-configure-influxdb-on-centos-8/

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Mel
Melhttps://unixcop.com
Unix/Linux Guru and FOSS supporter

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook