Grafana Dashboard With GPU And CPU Combined Statistics

Ranjit Jadhav
5 min readFeb 2, 2021

What I achieved?

To display the Grafana dashboard for Windows with CPU statistics is a bit easy, but it is complicated to display the Grafana dashboard with GPU statistics. For that, I have studied and investigated different Grafana data sources and checked how I can create the Grafana dashboard for windows to show GPU and CPU statistics in a single Grafana dashboard. After investigation, I have chosen the influx DB data source and Telegraf plugin. Fetched CPU and GPU statistics in Telegraf plugin then Configured Telegraf with influx DB data source and created nice look Grafana dashboard with GPU and CPU statistics for Windows os. I have fetched statistics for intel 64 family 6 model 85 stepping 4 genuineIntel ~1995 Mhz processor and Nvidia Tesla T4 GPU in my machine.

Prerequisites To Show Grafana Dashboard For Windows OS

To get started with Grafana first I have understood the following concept:

Influx DB

Telegraf

Grafana

How To Create Grafana Dashboard For Windows OS?

Grafana can be connected with data sources such as Graphite, Prometheus, Influx DB, Elasticsearch, MySQL, PostgreSQL, etc.

I have chosen the Influx DB data source.

Steps To Create Grafana Dashboard On Windows OS:

Step 1: Install Influx DB.

To Install Influx DB go to the Influx DB official site https://portal.influxdata.com/downloads/ and download a suitable version.

  1. Select the latest version. Currently, I have used the v2.0.3 version

Once I complete the download, extract the Influx DB zip file. THE influx DB folder structure looks like below.

2. To start Influx DB I did some changes in the configuration file which is removed the comment from the following line.

Enabled = true
bind-address = “:8086”

3. Create meta, data, and wal named directory. I have kept it parallel to the influx DB directory.

4. Change meta, data, and wal file path in influxdb.conf file.

5. Start the Influx DB data source with influxd.exe. THE influx DB output looks like below.

Step 2: Install Telegraf

  1. To download Telegraf, head over to the InfluxDB downloads page (Influx DB Official site) and click on the latest version of Telegraf available.

2. Extract the Telegraf zip file and find the Telegraf configuration and Telegraf application file in that. Then create the Telegraf folder in C:\Program File Location and copy the Telegraf application and configuration file into that location.

3. To monitor nvidia gpu statistics with Telegraf, I have added the following configuration in telegraf.conf file, before that check nvidia-smi.exe file location. If nvidia-smi.exe file is not present at “C:\\Program Files\\NVIDIA Corporation\\NVSMI\\ “ location then find and copy nvidia-smi.exe into “C:\\Program Files\\NVIDIA Corporation\\NVSMI\\ “ location.

I have added folllowing configuration in telegraf.conf file for monitoring nvidia gpu statastics.

[[inputs.nvidia_smi]]
bin_path = “C:\\Program Files\\NVIDIA Corporation\\NVSMI\\nvidia-smi.exe”

4. Remove comment from the following line in telegraf.conf.

[[outputs.influxdb]]
urls = ["http://localhost:8086"]
database = telegraf

5. Start Telegraf application with telegraf.exe. Telegraf output looks like below.

Step 3: Install Grafana

  1. Install Grafana on windows by using Grafana official site and extract it.

Grafana folder structure looks like below :

2. Start Grafana with the grafana-server.exe file. Grafana output looks like below.

3. Login to Grafana with the default username and password.

username: admin
password: admin

4. Add a data source.

Click on Add your first data source.

5. Select a data source.

I have used Influx DB data source.

6. Fill all details with the database name Telegraf and click on the save & test button to check whether the data source is working or not.

7. I have taken Grafana dashboard for windows from below Grafana official site and used 12916 Grafana dashboard id which is windows host.

https://grafana.com/grafana/dashboards/12916

8. Click on the plus(+) button which is in the left side tab and load Grafana ID 12916.

9. Select the InfluxDB data source option in influxdb dropdown and import.

10. Check the Grafana dashboard for the Windows host.

11. Check the host option in Grafana. If the host option is blank or none then open Windows PowerShell and check the system hostname with the below command and put that into the Grafana host.

[System.NET.DNS]::GetHostByName(‘’)

Final Result:

Configure Grafana With Web Application:

I have configured Grafana in my web application with the following code. Just copy Grafana URL from the browser and put it into the src tag of an iframe.

<iframe id="grafanaIframe" src="http://localhost:3000/d/000000888/fos?orgId=1&refresh=5m&var-interval=$__auto_interval_interval&var-host=DESKTOP-O521H35&var-DB=default&var-instance=All"></iframe>

Conclusion:

This blog is for the people who want to show the Nvidia GPU statistics with Intel CPU on the web application. I struggled to get these things combined but found this solution, hope this will help you.

--

--

Ranjit Jadhav

Consultant: Microservices @Iauro System Private Limited