TIG Stack installation 📊 (Telegraf, InfluxDB and Grafana) on Ubuntu 22.04 made easy 🚀

Picture of Chris Beye

Chris Beye

Systems Architect @ Cisco Systems

Table of Contents

Introduction

You installed a fresh Ubuntu 22.04 VM and you quickly want to set up a TIG stack to get telemetry data from your network devices? 
In this post, I will show you what needs to be done on a baremetal or a docker installation. 

Setting up services is not what we usually do daily. As I needed to set up the TIG stack I tried to get all information from different sources and briefly wrote down each command which is necessary:

Option 1: Using Baremetal
TIG Stack installation commands
				
					sudo apt install -y ca-certificates curl gnupg lsb-release
sudo mkdir -p /etc/apt/keyrings && echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/grafana.gpg] https://packages.grafana.com/oss/deb \
  stable main" | sudo tee /etc/apt/sources.list.d/grafana.list > /dev/null
curl -fsSL https://packages.grafana.com/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/grafana.gpg
sudo apt update
sudo apt install -y influxdb influxdb-client telegraf grafana net-tools
sudo systemctl enable grafana-server
sudo systemctl start grafana-server

sudo systemctl | egrep 'telegraf|grafana-server|influxdb'
sudo netstat -tulpn | egrep 'telegraf|grafana-server|influxd'

INFLUX_DB=telegraf
INFLUX_USER=telefraf
INFLUX_PW=telegraf

influx -execute "CREATE DATABASE $INFLUX_DB" 
influx -execute "CREATE USER $INFLUX_USER WITH PASSWORD '$INFLUX_PW'" 
influx -execute "show databases" 
influx -execute "show users"

sudo sed -i -e 's%#\[\[outputs.influxdb]]%[[outputs.influxdb]]%' \
-e '119s%.*# database = "telegraf"%database = "telegraf"%' \
-e '152s%.*# username = "telegraf"%username = "$INFLUX_USER"%' \
-e '153s%.*# password = "metricsmetricsmetricsmetrics"%password = "$INFLUX_PW"%' \
-e 's%# \[\[inputs.cisco_telemetry_mdt]]%[[inputs.cisco_telemetry_mdt]]%' \
-e '7143s%#  transport = "grpc"%transport = "grpc"%' \
-e '7146s%#  service_address = ":57000"%service_address = ":57000"%' \
/etc/telegraf/telegraf.conf

sudo systemctl restart telegraf && sudo systemctl status telegraf
				
			
TIG Stack installation commands
Option 2: Using docker

A Cisco colleague prepared a very nice shell script that will kick off the entire process and configure the services in a Docker environment. With just a couple of commands, everything is up and running within a couple of minutes.

For a full description of the is done, please visit his GitHub Page: https://github.com/dsx1123/telemetry_collector

He also presented on Cisco Live a very interesting session: Streaming Telemetry on Cisco NX-OS – BRKDCN-2991

If you have access to the CiscoLive OnDemand library it’s highly recommended to watch the session. 

Docker installation commands
				
					git clone https://github.com/dsx1123/telemetry_collector.git
cd telemetry_collector
GNMI_USER=gnmiuser
GNMI_PASSWORD=gnmipassword
sudo ./build.sh start
				
			
				
					Usage: ./build.sh {start|stop|restart|cert|clean}
  start  :   start docker containers for telegraf/influxdb/grafana
  stop   :   stop docker containers for telegraf/influxdb/grafana
  down   :   stop and remove docker containers for telegraf/influxdb/grafana
  restart:   restart docker containers for telegraf/influxdb/grafana
  cert   :   generate certificates for telegraf plugin
  clean  :   clean the database of influxdb, volume of grafana
  reset  :   reset project to inital state

				
			
Checking the services

Open in the browser the IP of your server with port 3000: http://w.x.y.z:3000

Import InfluxDB and Dashboard in Grafana

Let’s configure our InfluxDB as a source and import a dashboard that is using the Telegraf metrics to test our stack 📊 🚀

Use: http://localhost:8086 as a URL

Configure your database/user & password which has been specified in during the installation. Save & Test 

If everything is working, go to the Explore page and build your first query to retrieve data from the InfluxDB.

Let’s import a Dashboard to visualize the data from our Linux server provided by the Telegraf input plugin.

Go to Dashboard > Import

Grafana offers a lot of Dashboards ready to use. 

I picked this dashboard, which looks super nice:

https://grafana.com/grafana/dashboards/928-telegraf-system-dashboard/

Click on “Copy ID to Clipboard” 

Paste the ID and Load the Dashboard.

If your server sits behind a proxy just download the Json code in the previous step and import the Json.

Now you can change the name of the Dashboard and define the InfluxDB that we added in a previous step.

Awesome! Our dashboard is imported and what can I say, it looks beautiful! 👏