Categories
homelab

Add Unraid To Your Grafana Dashboard

In a previous post I walked through how to setup Grafana for your homelab. Grafana and InfluxDB are installed on a virtual machine and will collect the data sent from other services and machines in my homelab.

Start there if you don’t have InfluxDB and Grafana installed.

Step 1. Install HDDTemp Docker

We need to install 2 Dockers in Unraid. First, let’s add HDDTemp:

Unraid HDDTemp Docker
HDDTemp Docker in Unraid

I used the default settings and clicked “Apply”.

HDDTemp Installation
HDDTemp Docker Installation

Step 2. Install Telegraf Docker

Next, install the Telegraf docker (choose the one with the green thumb):

Telegraf Docker in Unraid
Telegraf docker in Unraid

I’m also going to leave the default settings for the Telegraf installation:

Telegraf docker installation

You should see both docker containers under the docker section in Unraid:

HDDTemp and Telegraf dokcers in Unraid
HDDTemp and Telegraf dokcers in Unraid

Step 3. Setup Telegraf

We need to manually add the Telegraf configuration file before we can start Telegraf. The default file is located here: https://github.com/influxdata/telegraf/blob/master/etc/telegraf.conf. We need to place that in the /mnt/user/appdata/telegraf/ folder. You can also specify a different location under the Telegraf docker container settings.

First, I’m deleting the telegraf.conf directory that was created during the Telegraf installation.

Note: For some reason this directory is created during install (at least for me). If you want to leave the default container settings this needs to be removed and replaced with an actual file.

I’m using the Unraid web terminal to do the following:

rm -rf /mnt/cache/appdata/telegraf/telegraf.conf

Note: If you have already run mover after you installed Telegraf, you will need to use /mnt/user/appdata/telegraf/telegraf.conf.

Get the default Telegraf file.

wget https://raw.githubusercontent.com/influxdata/telegraf/master/etc/telegraf.conf -P /mnt/cache/appdata/telegraf/

Use nano to edit the file.

nano /mnt/cache/appdata/telegraf/telegraf.conf

Change the InfluxDB settings to the location of your InfluxDB:

InfluxDB settings in Telegraf config file
InfluxDB settings in Telegraf config file

Uncomment (remove the # character) from the following plugins:

[[inputs.hddtemp]]

[[inputs.net]]

[[input.sensors]]

[[input.smart]]

Ctrl+O and then hit return to write the file.

Ctrl+X to exit the file.

Run the mover.

mover

Step 4. Verify Data

Log into the system where your InfluxDB is installed.

ssh jeff@192.168.2.144

Login to InfluxDB

influx -username admin -password YOURPASSWORD

Select the database where your Unraid data is being sent:

use telegraf
show measurements

Run a quick query to make sure you are getting data from Unraid:

select * from cpu where time > now()-10s

It should look something like this:

InfluxDB data from Unraid
InfluxDB data from Unraid

Step 6. Grafana Dashboard

Login to Grafana. We’ll assume you already have a the InfluxDB data source setup. If not, add that under Configuration > Data Sources > Add data source.

There are a number of really great dashboards that can help you get started. I recommend importing an existing dashboard to give you some ideas on how the data can be visualized in Grafana.

You can search “Unraid” here: https://grafana.com/grafana/dashboards to see what others have created.

A very robust dashboard is #7233. To import this, go to the import option in your Grafana installation and enter 7233 when asked for the dashboard ID.

Import Grafana Dashboard
Import Grafana Dashboard

Notes.

My current Grafana dashboard for Unraid looks like this:

Grafana dashboard for Unraid

Unraid Server

My current Unraid server configuration consists of a Dell r720xd with an assortment of mixed size drives:

Dell r720xd LFF (12 x 3.5 hdd bays, 2 x 2.5 flex bay)
Intel Xeon E5-2620 (x2)
1100W Power Supplies
32GB DDR3 Memory
Dell Perc H310 Mini
Parity Drive: 3TB Dell SAS 3.5 HDD
Storage Array: 6 x 2.5 & 3.5 Dell SAS HDDs (600GB-3TB)
Cache Drives: 2 x Samsung 850 Pro SSD 120GB (flex bay)
16GB USB Flash Drive (boot drive)
Nvidia GTX 970 Founders Edition