Grafana Excel Report Download — Part1

If you don’t have time to read but want to know what’s there in this post. Find the quick read 👇

In Grafana OSS(Open Source) we can’t download the reports in PDF or Excel format. but there are few plugins available for PDF which would take a snapshot of the panels.
But to download the report as excel we don’t have any option all we have is to download panel data as CSV.
Today, we are going to see how to download the data collected by InfluxDB as an excel report in Grafana using NodeJS.

Overall Flow
What we are going to do
In this series, we will see how to download the system metrics data which is stored in InfluxDB from Grafana using the NodeJS application.

Milestones
Create a telegraf configuration to collect system metrics
Run the telegraf agent to send system metrics
Create a Dashboard in Grafana for system metrics using InfluxDB as a data source
Create a NodeJS application to collect system metrics from InfluxDB using client libraries
Create the Excel report using the collected metrics
Configure Grafana to download the report
What we are going to do in Part 1
In this part, we will see how to
Create a telegraf configuration to collect the system metrics
Run the telegraf agent to send system metrics
Create a Dashboard in Grafana for system metrics using InfluxDB as a data source
1. Create a telegraf configuration to collect system metrics
Before starting make sure you have telegraf installed in your system as well as InfluxDB running.If not kindly look at the above articles 👆.
Open InfluxDB and then click Data ➡️ Telegraf you could see a page like below

Create Configuration
Click Create Configuration and then select the bucket from the dropdown menu to which the metrics need to store.

Selecting the metric
Once the metric is selected click Continue and then you could receive a token like below (Copy it will use it later)

InfluxDB Token
Once the Token is copied click Finish and then download the configuration

Configuration File
Congrats on completing 1️⃣st milestone 👏 in this part

Milestone 1
Just take a quick break to know about Telegraf 👇

Quick Read #1
2. Run the telegraf agent to send system metrics
Once the configuration file is downloaded paste the InfluxDB token which you have copied earlier into telegraf.conf or you can export it is as an InfluxToken also. Once the token is added start the telegraf service and then use the following command to run telegraf like below
telegraf --config path-of-your-telegraf.conf

Telegraf command
Once you run the telegraf agent you could see an output like below

Congrats on completing the 2️⃣nd milestone 👏

Milestone 2
Just take a quick break to know about Grafana 👇

Quick Read #2
3. Create a Dashboard in Grafana for system metrics using InfluxDB as a data source
👆Click the button for download instructions
Once you have installed Grafana and started the Grafana instance in your machine. Open your browser and type localhost:3000 you could see the login page of Grafana like below

Grafana Login Page
If you log in for the first time then the username and password is admin and admin.If not log in with the credentials you have set earlier.
Now click on Settings ➡️ Datasource like below

Data source
Now Click Datasource ➡️ Add data source and type InfluxDB like below

InfluxDB Datasource
Now click InfluxDB and fill in the details like below 👇

InfluxDB Configuration
Now click Save & Test where you could see a result like below

Datasource connected
Now you have successfully connected with InfluxDB.Now we will create the dashboard for system metrics
Click on the ‘+’ icon to import a new dashboard.

Import Dashboard
Now copy the JSON 👇
Click the Copy Dashboard button 👆
Once you have copied the JSON paste the code into Grafana and click Load

Load Dashboard
Once you click the Load button select the folder in which you want to save the dashboard like below

Importing Dashboard
Once you import the dashboard you could see some errors in the dashboard 😨. Don’t get freaked out just click the Dashboard settings

Dsahboard settings
and then select Variables and click the hostname

Change the hostname to the one which you have seen in your InfluxDB and then click update

changing host name
Make sure the default dashbaord is InfluxDB
Once it is done you could see the dashboard like 👇

Congrats on completing the 3️⃣rd milestone 👏

Milestone 3
Congratulations 🏆
You have completed Part 1️⃣ milestones. Get ready for the Part 2 milestone. Till then Happy Learning 😄






