There is a new version of this tutorial available for Ubuntu 22.04 (Jammy Jellyfish).

How to Install TIG Stack (Telegraf, InfluxDB, and Grafana) on Ubuntu 18.04 LTS

InfluxDB is an open-source time series database written in Go. Optimized for fast, high-availability storage and used as a data store for any use case involving large amounts of time-stamped data, including DevOps monitoring, log data, application metrics, IoT sensor data, and real-time analytics.

Telegraf is an agent for collecting, processing, aggregating, and writing metrics. It supports various output plugins such as influxdb, Graphite, Kafka, OpenTSDB etc.

Grafana is an open source data visualization and monitoring suite. It offers support for Graphite, Elasticsearch, Prometheus, influxdb, and many more databases. The tool provides a beautiful dashboard and metric analytics, with the ability to manage and create your own dashboard for your apps or infrastructure performance monitoring.

In this tutorial, I will show you how to install and configure the TIG Stack (Telegraf, influxdb, and Grafana) using a single Ubuntu 18.04 Server. We will be using the TIG Stack for monitoring the system loads such as Network, RAM Memory, Uptime etc.


  • Ubuntu 18.04
  • Root privileges

What we will do?

  1. Install InfluxDB
  2. Create InfluxDB Database and User
  3. Install Telegraf Agent
  4. Configure Telegraf
  5. Install Grafana
  6. Setup Grafana Data Source
  7. Setup Grafana Dashboard

Step 1 - Install InfluxDB

In this first step, we will install the time series database influxdb on the Ubuntu system. We will install both 'influxdb' and the 'telegraf' from the same 'influxdata' Repository, both software were created by the same organization.

Add the influxdata Key.

sudo curl -sL | sudo apt-key add -

Add the influxdata repository.

source /etc/lsb-release
echo "deb${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

Now update the repository and install the 'influxdb' package using the apt command below.

sudo apt update
sudo apt install influxdb -y

Install InfluxDB

After the installation is complete, start the influxdb service and enable it to launch every time at system boot.

sudo systemctl start influxdb
sudo systemctl enable influxdb

Now check the opened ports on the system.

netstat -plntu

Check open ports with netstat

And make sure you get influxdb ports '8088'and '8086' on the 'LISTEN' state.

Step 2 - Create InfluxDB Database and User

In order to store all data from telegraf agents, we need to set up the influxdb database and user.

InfluxDB provides the CLI tool named 'influx' for interacting with an InfluxDB server. Influx command is like the 'mysql' on MySQL, and 'mongo' on the MongoDB database.

Run the 'influx' command below.


Now you are connected to the default influxdb server on port '8086'.

Create a new database and user 'telegraf' with the password 'hakase-ndlr' by running influxdb queries below.

create database telegraf
create user telegraf with password 'hakase-ndlr'

Now check the database and user.

show databases
show users

Make sure you get the database and user named 'telegraf' on the influxdb server.

Create InfluxDB Database and User

Step 3 - Install Telegraf Agent

Telegraf was created by 'influxdata', same organization which created the influxdb. So when we add the influxdata key and repository to the system, it means we can install both applications.

Install the telegraf package using the apt command below.

sudo apt install telegraf -y

After the installation is complete, start the telegraf service and enable it to launch everytime at system startup.

sudo systemctl start telegraf
sudo systemctl enable telegraf

The telegraf agent is up and running, check it using the command below.

sudo systemctl status telegraf

Install Telegraf Agent

Step 4 - Configure Telegraf

Telegraf is a plugin-driven agent and has 4 concept plugins type.

  1. Using the 'Input Plugins' to collect metrics.
  2. Using the 'Processor Plugins' to transform, decorate, and filter metrics.
  3. Using the 'Aggregator Plugins' to create and aggregate metrics.
  4. And using the 'Output Plugins' to write metrics to various destinations, including influxdb.

In this step, we will configure the Telegraf to use basic input plugins for collecting system metric of the server and using the influxdb as the output plugin.

Go to the '/etc/telegraf' directory and rename the default configuration file.

cd /etc/telegraf/
mv telegraf.conf telegraf.conf.default

Now create a new other configuration 'telegraf.conf' using vim editor.

vim telegraf.conf

Paste configurations below.

# Global Agent Configuration
  hostname = "hakase-tig"
  flush_interval = "15s"
  interval = "15s"

# Input Plugins
    percpu = true
    totalcpu = true
    collect_cpu_time = false
    report_active = false
    ignore_fs = ["tmpfs", "devtmpfs", "devfs"]

# Output Plugin InfluxDB
  database = "telegraf"
  urls = [ "" ]
  username = "telegraf"
  password = "hakase-ndlr"

Save and exit.

Configure Telegraf


Telegraf provides telegraf command to manage the configuration, including generate the configuration itself, run the command as below.

telegraf config -input-filter cpu:mem:disk:swap:system -output-filter influxdb > telegraf.conf
cat telegraf.conf

Telegraf config

Restart the telegraf service and make sure there is no error.

sudo systemctl restart telegraf

Now test the telegraf settings using the command below.

sudo telegraf -test -config /etc/telegraf/telegraf.conf --input-filter cpu
sudo telegraf -test -config /etc/telegraf/telegraf.conf --input-filter net
sudo telegraf -test -config /etc/telegraf/telegraf.conf --input-filter mem

Test config

The InfluxDB and Telegraf configuration has been completed.

Step 6 - Install Grafana

In this step, we will install the beautiful Grafana Dashboard for data visualization.

Add the grafana key and repository.

sudo curl | sudo apt-key add -
echo 'deb stretch main' > /etc/apt/sources.list.d/grafana.list

Update the repository and install the grafana package using the apt command below.

sudo apt update
sudo apt install grafana -y

Install Grafana

After the installation is complete, start the grafana service and enable it to launch everytime at system boot.

sudo systemctl start grafana-server
sudo systemctl enable grafana-server

The grafana-server is up and running on default port '3000', check it using netstat.

netstat -plntu

And you will get the result as below.

Check ports

Step 7 - Setup Grafana Data Source

Open your web browser and type the server IP address with port 3000.

Login with the default user 'admin' and password 'admin'.

Login to Grafana

Now you will be prompted with the page for changing the default password, type your new password and click the 'Save' button.

Set new password

And you will be redirected to the default Grafana Dashboard.

Click the 'Add data source' button to add the influxdb data source.

Grafana Dashboard

Type details about the influxdb server configurations.

  • Name: influxdb
  • Type: influxdb
  • URL: http://localhost:8086/

Set influxdb details

Scroll to the bottom page and type details of influxdb database settings.

  • Database: telegraf
  • User: telegraf
  • Password: 'hakase-ndlr'

Database settings

Click the 'Save and Test' button and make sure you get the 'Data source is working' result.

The InfluxDB data source has been added to the Grafana server.

Step 8 - Setup Grafana Dashboard

After adding the influxdb as a data source to the grafana server, in this step we will import the grafana dashboard based on our Telegraf input plugins setup.

Grafana provides the repository for grafana plugins and dashboards.

To import the grafana dashboard, click on the '+' menu on the left panel and click 'Import'.

Setup Grafana Dashboard

Now open the sample Grafana dashboard from URL '' and click the 'Copy the ID to Clipboard' button.

Paste the dashboard id.

Import dashboard config

And you will be redirected automatically to the dashboard setup.

On the options section, click the InfluxDB and choose your influxdb server, then click 'Import' button.

Influxdb server import

And below are some screenshots from the imported dashboard.

Imported dashboard 1

Imported dashboard 2

The TIG Stack (Telegraf, InfluxDB, and Grafana) installation on Ubuntu 18.04 has been completed successfully.


Share this page:

22 Comment(s)

Add comment

Please register in our forum first to comment.


By: Chris Kozma

Hi! This works wonderfully, however the 'net' test command for telegraf returns 'Error: no inputs found, did you provide a valid configuration file?'. How can I resolve this issue? Thanks again for the wonderful guide!

By: Mayur Patel


Your website is very helpful and one of the best website in open source ,,,but i need install telegraf , grafana and influxdb in docker and visulise graf  so if possible please upload process.. 




By: MattG

Grafana has moved their repository... here's there notes.

By: bubee


APT Repository

Create a file /etc/apt/sources.list.d/grafana.list and add the following to it.

deb stable main

There is a separate repository if you want beta releases.

deb beta main

Use the above line even if you are on Ubuntu or another Debian version. Then add our gpg key. This allows you to install signed packages.

curl | sudo apt-key add -

By: shoab

This is Awesome :)

By: Hugo

Thanks man! Impeccable setup following this guide. 

By: Dombo71

Dear thanks for this nice tut....


Only i do have 1 problem..

Influx is running, only i not using the the port 8088 and 8086

1 problem i cannot find the config file taht is influx is using:

<code>  influxdb.service - InfluxDB is an open-source, distributed, time series database   Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset: enabled)   Active: active (running) since Mon 2019-06-10 09:43:06 CEST; 524ms ago     Docs: Main PID: 19337 (influxd)   CGroup: /system.slice/influxdb.service           ??19337 /usr/bin/influxd -config /etc/influxdb/influxdb.conf</code>



[email protected]:~$ influxFailed to connect to http://localhost:8086: Get http://localhost:8086/ping: dial tcp [::1]:8086: connect: connection refusedPlease check your connection settings and ensure 'influxd' is [email protected]:~$</code>


So i hope you can help me..


By: naeimeh


tnx for your article. I have a problem, when I change the telegraf.conf file , I should drop influx database and create a new database to see the change in grafana. Do you have any solution?


By: Asad Ali

cd /etc/telegraf/mv telegraf.conf telegraf.conf.default2nd command shows cd /etc/telegraf/ mv telegraf.conf telegraf.conf.default error "mv: cannot move 'telegraf.conf' to 'telegraf.conf.default': Permission denied" How to resolve it.

By: Jon

Put "sudo" at the start of the command.

By: Ty

Repo moved.

sudo curl | apt-key add -echo 'deb stable main' > /etc/apt/sources.list.d/grafana.list

By: Jon

OK, I'm a bit confused here.  You say to create a new telegraf.conf file by doing 

vim telegraf.conf

and pasting in the config you provide, followed immediately by 

telegraf config -input-filter cpu:mem:disk:swap:system -output-filter influxdb > telegraf.conf

which overwrites that config.  


By: Trebbor38

STEP 6 - Firstpart/steps must be:

sudo curl | sudo apt-key add -

echo 'deb beta main' > /etc/apt/sources.list.d/grafana.list

By: Matt

Nice one trevor, thx

By: george raveen

Thanks a lot. Really helpful

By: Jamie Brindle

 I've just got one thing to say really... Which is WOW! and thank you for your time and effort.




By: Kestouf


I encounter two problem with your: telegraf config -input-filter cpu:mem:disk:swap:system -output-filter influxdb > telegraf.conf

The first is that when you launch it: bash: telegraf.conf: Permission denied So I made a chmod 777 telegraf.conf

Once the chmod done, I relaunch the command and there it overwrites the telegraf.conf file with a completely new one and does not take at all into account what was in the modified telegraf.conf. Can you help me please?

By: Ailesdek

In Raspberry Pi perfect. Thanks.

By: Arun John

Excellent, very clear article!

Only comments to add - Rather than use the mentioned links to install Grafana, I went to the Grafana website and got the repository link, which gave a more recent version I think. Also, in Grafana, when doing the Add Data Source, it is essential to mention the hostname/URL (even if the form shows you the same in a greyed 'default value' format). Else you get a 502 error on testing the data source.

Thanks for this nice article and its great that TIG stack works almost 'out of the box' - Hope more solutions deploy and get set up so quickly, without any hassle!

By: chun

I installed influxdb as your instruction and everything looks the same as your instruction.

But after I type in influx command, it did not show the command line, instead it shows available commands.

The influx cli version is 2.0.0, is it the reason that I cannot see the command line?

If that is the reason, how can I install the older version of the cli.

Thank you in advance.

By: k



By: Manuel

i know it's an old article, but i saw this and i was trying to implement it, just i'm having trouble getting the data from NH, hai by any chance a guide on how to implement the script on telegraf?