Search
  • Anuradha Agarwal

Set Up Telegraf On Linux Machine for Monitoring

Updated: May 6

In this post, I will be taking you through end to end steps to set up Telegraf on Linux Server. Telegraf by default collects host data. We will be configuring Telegraf to send data to InfluxDB and further view it in Grafana.

Telegraf is a monitoring agent from TICK stack of InfluxDB and collects data from diverse sources and can send data to diverse destinations.


To visit more such posts follow hashtag - #RealTimeMonitoring#InfluxDB#Docker#Grafana





PRE-MILESTONE STEPS

Step 01 - Avail Linux Machine or Connect to AWS Instance

Step 02 - Avail InfluxDB & Grafana Instance



MILESTONE STEPS

Step 1 - Download Telegraf rpm on Linux machine

Step 2 - Install Telegraf

Step 3 - Configure Telegraf for Sending Data to InfluxDB

Step 4 - Verify/Run Telegraf service

Step 5 - Verify Host Data in InfluxDB

Step 6 - Add Datasource & view data in Grafana


  • Go to portal page to download telegraf & check the latest rpm.

  • Copy the command to download telegraf rpm


On Linux machine to be monitored give the copied command like below:


mkdir telegraf
cd telegraf
wget https://dl.influxdata.com/telegraf/releases/telegraf-1.14.2-1.x86_64.rpm


  • Give below command to install telegraf:

sudo yum install -y <telegraf rpm>
  • Telegraf config file is located at the standard location - /etc/

cd /etc/telegraf/
  • Edit telegraf.conf --> section output plugins --> outputs.influxdb

  • Update URLs with IP address of InfluxDB.

  • Please note if you don't have InfluxDB & Grafana instance set up. Browse this post

  • Telegraf service should be running automatically. Verify the status:

sudo systemctl status telegraf
  • If it is not running, give:

sudo service telegraf start

  • Telegraf by defaults sends host monitoring data to InfluxDB.Verify through logs if all is good:

sudo journalctl -f -u telegraf.service

Congratulations. Telegraf is setup and host monitoring data is being sent to InfluxDB.Now let's do further steps to verify data in InfluxDB & visualize it in Grafana.

Go to InfluxDB CLI by giving command on the machine on which influx is installed:

influx

  • In this post, I ran InfluxDB in a container. Hence first, I will access the container using docker command and container name:

 docker exec -it influxdb_container sh
  • Database telegraf is created automatically. Data can be verified from measurements using select query


Now let's visualize this data in Grafana.


In this post, I ran the Grafana container.I would be accessing same instance to configure telegraf data source and view data




0 views
Never Miss a Post. Subscribe Now!