Image: Jack Wallen

System admins are always looking for ways to gain access to more and better information about the servers they manage. To that end, they’ll go to just about any length for the right tool. If the servers in question are the Linux sort, there are a host of options available for the producing and displaying of data. One such option is a combination of tools, called a TIG stack.

TIG stands for:

  • Telegraf – An agent for collecting, processing, aggregating, and producing metrics.
  • InfluxDB – An open source database, optimized for large amounts of time-stamped data.
  • Grafana – An open source data visualization tool.

When combined, these services make for an incredibly powerful tool that gives the admin real-time information about a server. I’m going to walk you through the process of installing a TIG stack on the Ubuntu Server 18.04 platform.

SEE: Network security policy (Tech Pro Research)

What you need

All you need to make this happen is an Ubuntu Server 18.04 and a user account with sudo privileges.


Before we install the TIG stack, let’s update and upgrade Ubuntu. Know that, if the upgrade includes the kernel, you need to restart the server. Because of this, make sure to run the update/upgrade at a time when a server reboot is possible. With that said, open a terminal and issue the commands:

sudo apt-get update
sudo apt-get upgrade -y

Once that completes, reboot the server (if necessary) and prepare to install.

Install the database

The first step is the installation of the database. To do this, open a terminal window and issue the following commands:

sudo curl -sL | sudo apt-key add -
source /etc/lsb-releaseecho "deb${DISTRIB_ID,,}
${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo apt update
sudo apt install influxdb -y

With that installation complete, start and enable the database with the commands:

sudo systemctl start influxdb
sudo systemctl enable influxdb

Before we move on to the next installation, let’s create the database with the commands:

create database telegraf
create user telegraf with password 'PASSWORD'

Where PASSWORD is a unique, strong password.

Install and configure Telegraf

Next, we install the Telegraf agent. This is accomplished with the following command:

sudo apt install telegraf -y
Start and enable Telegraf with the commands:
sudo systemctl start telegraf
sudo systemctl enable telegraf

We now need to configure the Telegraf agent. Out of the box, it comes with a default configuration file. We’ll rename that with the following command:

sudo mv /etc/telegraf/telegraf.conf /etc/telegraf/telegraf.DEFAULT.conf

Create a new configuration file with the command:

sudo nano /etc/telegraf/telegraf.conf

Paste the following into the new file:

# Global Telegraf Agent Configuration
hostname = "HOSTNAME"
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 = "PASSWORD"

where HOSTNAME is the hostname of the hosting machine and PASSWORD is the password you created for the influxdb.

Save and close that file.

We now have to run a command to re-configure our newly created config file (so that it meets the Telegraf requirements). That command is:

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

Restart telegraf with the command:

sudo systemctl restart telegraf

Install Grafana

The installation of Grafana can be taken care of with the following commands:

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

When the installation completes, start and enable Grafana with the commands:

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

Setup your data source

Open a browser and point it to http://SERVER_IP:9000. You will be prompted to log into Grafana. Use the following credentials:

  • User – admin
  • Password – admin

You will then be prompted to change the admin password. Do so, and you will be logged into Grafana. From the main window (Figure A), click Add data source.

Figure A

In the resulting window (Figure B), fill out the following information;

  • Name – influxdb
  • Type – influxdb
  • URL: http://localhost:8086/
  • Database: telegraf
  • User: telegraf
  • Password: ‘PASSWORD’

where PASSWORD is the password you created for the InfluxDB user.

Figure B

Scroll down and click the Save and test button.

Setup the dashboard

Finally, we have to add a dashboard to Grafana. Back at the Grafana main window, click the + button and select Import. In the resulting window (Figure C), paste the following URL in the section labeled Paste dashboard url or id:

Figure C

Click Load, and the dashboard will automatically load into Grafana. In the resulting window, you must select your InfluxDB server from the Select a InfluxDB data source drop-down list. Click Import and the dashboard will be added to Grafana (Figure D).

Figure D

You are ready to start monitoring your server, via the newly installed TIG stack. Happy administrating.