Ubuntu Installation Guide (Grafana Influxdb Telegraf) - amitmaurya012111/Grafana_dashboard GitHub Wiki
Installation Guide
TIG stack is a group of powerful open-source monitoring tools, Telegraf, InfluxDB and Grafana where:
-
Telegraf is an open-source server agent for collecting and sending matrics and events from databases, systems, and IoT sensors.
-
InfluxDB is an open-source time series database and provides datastore for metrics, events, and real-time analytics.
-
Grafana is a data visualisation and monitoring tool and supports time series datastores such as Graphite, InfluxDB, Prometheus, Elasticsearch.
TIG stack can be used for monitoring system metrics such as memory, disk, logged in users, system load, swap usage, system uptime, system processes.
Install and Setup TIG on Ubuntu 20.04
For each component we need to do the installation.
1. Install Telegraf:
Simply copy the command below one by one for binary installer and paste it in terminal-
wget https://dl.influxdata.com/telegraf/releases/telegraf_1.14.3-1_amd64.deb
sudo dpkg -i telegraf_1.14.3-1_amd64.deb
systemctl enable --now telegraf
systemctl status telegraf
Below screen can be seen after successfully running above four command.
2. Install Influxdb:
Run the following command below in terminal for installation-
wget https://dl.influxdata.com/influxdb/releases/influxdb_1.8.0_amd64.deb
sudo dpkg -i influxdb_1.8.0_amd64.deb
systemctl enable --now influxdb
Below screen can be seen after successfully running above four command.
3. Install Grafana:
Run the following command below in terminal for installation-
sudo apt install –y adduser libfontconfig1
wget https://dl.grafana.com/oss/release/grafana_7.0.1_amd64.deb
sudo dpkg -i grafana_7.0.1_amd64.deb
systemctl daemon-reload
systemctl enable --now grafana-server
Below status can be seen after running above commands
4. Configure Influxdb to store system metrics collected by Telegraf:
We will create InfluxDB database for storing the time series metrics to be collected by the Telegraf agent. Connect to InfluxDB using the ‘influx’ client command.
Type ‘influx’ and hit enter
Next, create InfluxDB database. In this demo, I have created a database called ‘telegraf’ and a database user called ‘telegraf’. Type the commands below on your terminal:
create database telegraf
create database user telegraf with password ‘myP@SSword’
grant all on telegraf to telegraf
show databases
Type ‘exit’ and press Enter to exit influx window.
Exit InfluxDB and verify the connection to the database using the credentials created above by typing command:
influx –username ‘telegraf’ -password ‘’ -database telegraf
Enter the password I.e., myP@SSword. If all goes well, you should get InfluxDB prompt;
5. Configuring Telegraf to collect system Metrics
Telegraf is a plugin-driver server agent basically made up of four distinct plugin types:
-
Input plugins collect metrics from the system, services
-
Processor plugins transform, decorate, and/or filter metrics
-
Aggregator Plugins create aggregate metrics (e.g., mean, min, max, quantiles, etc.)
-
Output Plugins write metrics to various destinations such as InfluxDB in our case
/etc/telegraf/telegraf.conf is the default path for Telegraf configuration file.
Open telegraf.conf in vi editor and do the changes in plugins as required. Link for telegraf.conf text file is already attached below with most of the plugins in working state. Telegraf.conf
For further configuration of telegraf.config file go to Telegraf administration configuration
Restart and check status of telegraf after modifications of telegraf.conf file by typing below commands;
systemctl restart telegraf
systemctl status telegraf
6. Configure Grafana to display Influxdb/Telegraf Metrics
We can access Grafana web interface, https://server-ip-or-hostname:3000/. On the login page, type admin for both username and password. Reset the password and proceed to grafana web interface.
Add influxdb Data source:
- In grafana go to setting->Data Source->Add data source.
- Choose InfluxDB as datasource
-
In setting page set the following data as
Name = InfluxDB
Query language = InfluxQL
URL = https://localhost:8086/
Database = telegraf
User= telegraf
Password= myP@SSword
- Click save and test.
7. Create Grafana Telegraf Dashboard
In grafana import dahborad by clicking on import and upload json file.