Complete Unraid Monitoring

Complete Unraid Monitoring

Copying from various sources. Links at bottom of page.

I have for some time shared my Unraid System dashboard over at Grafana.com but never really had the time to make a quick write up on how to set it all up. So this will try to do just that. This guide will make it so you will be able to monitor cpu usage, cpu temps, network stats, ram usage and much more by simply importing a dashboard.

How it works

In getting all this setup, there are 3 main moving parts. TelegrafInfluxDB and Grafana.
Telegraf is what collects all the different system metrics and outputs it to an InfluxDB database that Grafana uses to visualize everything with pretty graphs and bars. 
This is a pretty simplified explanation and you can read more here: TelegrafInfluxDBGrafana

Installing Influxdb

Search for influxdb in Community Apps and install it using the default template. Select your appdata path and host ports if the default ones are taken.
There is no other setup than just installing the container.

Installing Telegraf

Do the same here, just search for the container in Community Apps and use the default template settings. Set the appdata location to where you want it.

Warning

This container wont start unless the telegraf.conf file already exists on the host. (Host path 7)
Do not install the container before you follow the steps below!

  1. Download the file and place it in the location you want the telegraf appdata to be.
    e.g. /mnt/cache/appdata/telegraf/telegraf.conf
    The default config file can be downloaded here: https://github.com/influxdata/telegraf/blob/master/etc/telegraf.conf
  2. Next you need to edit the telegraf.conf file. Go to the location you saved the file and scroll down to OUTPUT PLUGINS which should be around line 90-103.Uncomment (Remove #)  the http url line for InfluxDB like so:# urls = ["unix:///var/run/influxdb.sock"] # urls = ["udp://127.0.0.1:8089"] urls = ["http://192.168.1.34:8086"]192.168.1.34 is the IP address to my Unraid server and 8086 is the default InfluxDB port that runs the InfluxDB HTTP service.
  3. Next we need to setup the input plugins. A lot of these are already enabled but we need to add a couple so that all the panels on the Grafana dashboard will work.

Uncomment the following plugins and lines:

  • HDD temps:  [[inputs.hddtemp]]
  • CPU temps:  [[inputs.sensors]]
  • Network:  [[inputs.net]]and  interfaces = ["eth0"]
  • Netstat: [[inputs.netstat]]
  • Docker: [[inputs.docker]] and endpoint = "unix:///var/run/docker.sock"

Installing HDDtemp

For the hddtemp input to work we need to install the HDDTemp container. The container is in Community Apps. There is nothing special to configure here except the time zone variable. It’s not needed as Unraid already adds this. So you can just delete it.

After editing the telegraf.conf file and installing HDDTemp you can restart the Telegraf container. Telegraf will automatically create a database called telegraf when started for the first time with the influxdb plugin activated.

Installing Grafana

Installing Grafana is also quite simple. Chose your host port for the webUI and add your unraid URL and admin password to the container settings.

Configuring Grafana

After the installation is finished go to the WebUI. (http://unraidIP:3000) and log in with username admin and the password you chose. You should then see this on you screen:

Click on Add data source and select InfluxDB. 

Next give the data source a name, add the URL to InfluxDB, enter the database to use (telegraf) and click Save & Test


If all your settings are correct you should see this message.

Next import the dashboard by hovering over the + icon and selecting Import

Paste the dashboard ID 7233 and click Load
Give it a name and UID, select the database in the drop down and click Import.

Some assembly needed

You should now already see some of the panels working and displaying stats. But there will be some panels that you’ll need to edit manually. Those are:

  • Storage Consumption
  • Drive Temperature
  • Array read and write
  • Cache read and write

Here you need to edit the panel and choose the correct device name for each of the queries. Use the Unraid Main page to find out which drive is the correct one. You can Remove or duplicate and change any queries so it’s the same as your system.
NOTE: The drive names will change if you add or remove any drives to your system, so you will have to redo the panels each time that happens.

To switch drive names on the queries simply click on the panel name and select Edit, then click on the drive name and select the correct one in the drop down menu.

To update the drive names on the  Storage Consumption panel, edit the panel and go to the Visualization menu. There you will see the different Value Mappings for the different drive paths.

And that’s about it! This should get you going on adding or creating awesome dashboards for you Unraid system. There are tons of different dashboards on grafana.com to get inspiration from. My dashboard is far from the best one out there, so please share your awesome dashboards in the comment section or on Discord!

And if you’re wondering why my Grafana page looks different from the stock theme you can take a look here: https://github.com/gilbN/theme.park

Optional: Adding UPS stats

On the top of my dashboard I have UPS stats, now if you don’t have a UPS (You should by the way) you can just delete those panel. But if you have a UPS that’s compatible with Unraid you can check out this awesome guide:

UPS SETUP

I recently discovered the atribe/apcupsd-influxdb-exporter container on the CA plugin page and immediately thought it would be a great replacement for the script that I run, described in this post. But time got in the way and I forgot about it. But now the summer is here, the days are longer and free time is no longer a rarity 🙂 So this will be a quick follow up post on how to switch to this container and get even more accurate readings!

Grafana

If you haven’t installed or used Grafana and InfluxDB, I recommend reading this post first. You can skip the Telegraf part but that’s no fun 🙂

Installing the container

Search for apcupsd in CA and click install. Fill out the different container variables to match your setup.
Remember to click on Show more settings... to see the rest of the variables.

Warning

If your UPS has the NOMPOWER metric you need to remove this variable as it may interfere with how it reports the watts usage

You can see if it reports it by going to the dashboard and look at the stats or run the apcaccess command. apcaccess | grep NOMPOWER

The INFLUXDB_HOST and APCUPSD_HOST will most likely be your Unraid IP and INFLUXDB_PORT is the port for your InfluxDB http service. Default it will be 8086.
You can leave user and password blank if you don’t have a specific user you want to use in your InfluxDB instance.
The database will be created at the launch of the apcupsd container, so you don’t need to create it manually. If you’re using the php script from my previous post I recommend using a different database as the intervals are not the same and the queries in the first dashboard wont work.

If you want to change the interval you can add the INTERVAL variable set your desired value. Default is 10(seconds)

Note

If you change the interval you need to update the queries on the dashboard to reflect the change. The default is 360 values per hour (6 intervals per minute * 60 minutes)

Sources:

https://technicalramblings.com/blog/how-to-setup-grafana-influxdb-and-telegraf-to-monitor-your-unraid-system/
https://technicalramblings.com/blog/monitoring-your-ups-stats-and-cost-with-influxdb-and-grafana-on-unraid-2019-edition/

Leave a Reply