Sep 16, 2020

Monitoring Unraid in Home Assistant

Disclosure: This post contains affiliate links. If you click through and make a purchase, I’ll earn a commission, at no additional cost to you. Read my full disclosure here.

An illustration of an office with multiple computers on a network.

Unraid is a popular Linux-based operating system optimized for media file storage with network access. Unraid can also natively run docker containers, without the need of a virtual machine, which makes it a popular operating system for home servers. Using Docker, you can, of course, run Home Assistant Core. In fact, many in the community, including me, do exactly that.

Using Unraid, you can build your own NAS using off-the-shelf computer hardware. It has some unique advantages over TrueNAS Core which make it more suited for home use, which is why I made the switch. You'll find some Unraid guides on Home Assistant Guide's sister website if you are further interested.

One thing I was missing was seeing my Unraid system information in the Home Assistant frontend. Luckily, I knew from a previous setup that Home Assistant integrates with Glances. Using the Glances integration, you can monitor system information provided by the Glances API. So, all I had to do was get Glances installed on my Unraid system and configure the integration.

Table of Contents

What is Glances?

Glances is a cross-platform system monitoring tool written in Python. Incidentally, that is the same programming language Home Assistant is written in. Using Glances you can keep an eye on vital information such as your system's CPU and memory use, a whole host of sensors, and Docker containers.

You can access Glances using either the system terminal or the built-in web dashboard. It is built to be cross-platform compatible, and you can run it on just about any platform including Linux, FreeBSD, macOS, and Windows.

Installing Community Applications on Unraid

The easiest way of installing Glances on your Unraid system is by using the Community Applications plugin. There is a detailed installation guide on the Unraid forums on how to get the Community Applications working, so I won’t go through the setup process here. Simply follow the instructions on this page. Once completed you can get started with the installation of Glances.

The Unraid Community Applications tab

Alternative (manual) installation

If you don't fancy installing or using the Community Applications you can of course also manually set up a Glances docker container. For simplicity's sake I won't be going through that setup and I highly recommend you use the Community Applications. There is a perfectly set up template available which will spare you the whole process.

Installing Glances on Unraid

You should now have an extra menu item in your Unraid frontend titled Apps. Clicking on it will show you all the apps maintained by the Unraid community. These include Docker container templates and plugins. You even have the option of searching Docker Hug if there hasn't been a template set up for your desired app. Luckily though, there is a template for Glances. All you have to do is search for and install the Glances app.

Glances in the Unraid Community Applications

Once installed you are already half-way there. Next you will want to click on the Docker tab in the Unraid menu. You should now see your Glances container. If it hasn’t been started yet, you can start it. I also recommend that you enable autostart.

The Glances docker container in Unraid

Setting up the Glances integration in Home Assistant

The Glances integration is set up using the Home Assistant web dashboard. There will be no editing of YAML needed for this integration. Add a new integration in the Home Assistant settings and search for Glances. If you haven’t made any changes to the Glances docker container, all you have to do is enter your Unraid system's IP address and click on submit.

Setting up the Glances integration in Home Assistant

Once the integration is set up, you should be able to monitor values such as disk space used, disk temperatures, and hardware resources. These values can be displayed in your Lovelace frontend and/or used for automations. In the example below, I am using the popular Lovelace Mini Graph Card to display how full each hard drive is.

Unraid system information in the Home Assistant lovelace frontend

In terms of automation, you could use this integration to send you a notification when a hard drive or the cache reaches a certain limit or have it turn on a fan whenever the drives are getting too toasty.

Leave a comment

Share to...