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

Categories
homelab

How to monitor CPU temperature when using Untangle Firewall

So, you fired up your shiny new Untangle firewall and quickly realized there is no CPU temperature reading. For the tinkering type like me who cobbled together a mix of noctua fans and old enterprise hardware, a simple CPU temperature reading is a must.

Step 1. Turn on SSH

The first thing we need to do is turn on SSH in the Untangle control panel. Open a browser and enter the address of your Untangle installation.

Once logged in, go to Config > Network > Advanced > Access Rules and check the box under Enable on the “Allow SSH” line.

Click “Save” in the bottom right corner of the page.

Untangle Access Rules

Step 2. SSH login

Open Terminal or your favorite command line tool and login to Untangle. Replace the IP address below with your firewall address.

ssh root@192.168.2.1

Enter your user password when prompted.

Step 3. Add Debian Repository

Once logged in, we need to add the proper repo that will allow us to install lm_sensors, a linux hardware monitoring tool. The first step is to open and edit the sources.list file.

Open the file using nano.

nano /etc/apt/sources.list

Add this line to the newly opened file.

deb http://ftp.debian.org/debian stable main contrib non-free
Source list

Save the file with Ctrl+O and then hit your return key to write the file.

Ctrl+X to exit.

You should be back at the command line prompt.

Step 4. Update and Install

Run the following to install lm_sensors.

sudo apt update
sudo apt-get install lm-sensors

Step 5. Setup

Next we need to probe the hardware to determine what kernel modules can be loaded.

sudo sensors-detect

I personally used all “defaults” here by hitting the return key for each answer. You’ll get a summary at the end. And finally, it will ask you: “Do you want to add these lines automatically to /etc/modules?”. Hit return and you are done!

Step 6. Run Sensors

Type the following:

sensors

On my system it looks like this:

Dell r210 ii running lm_sensors

That’s it, you have an easy way to check temps on your Untangle machine.

Notes

I’m using a Dell r210 that has been upgraded with a Dell r210 ii motherboard to run Untangle NG Firewall. I have the home software license for Untangle.

Dell r210 upgraded to Dell r210 ii
Dell r210 upgraded to Dell r210 ii

The specs are:

Dell r210 chassis
Dell r210 ii motherboard
CPU: Intel Xeon E3-1220v2
Memory: 4GB
Storage: 120GB SSD
iDRAC 6 Enterprise
Noctua NF-A4x20 FLX (1) – power supply fan
Noctua NF-A4x20 PWM (3) – chassis fans

Categories
homelab

How To Create A Grafana Dashboard for Your Homelab

The first thing I want to show is the organization of my homelab so you can visualize where each operating system resides and how the data will be sent to our InfluxDB and then displayed on the Grafana dashboard.

Homelab

Step 1. Choose a location and operating system for Grafana & InfluxDB

I’m going to create a Ubuntu 20.04 virtual machine using Hyper-V on a machine running Windows Server 2019. This is my small form factor Dell r420 and I’m choosing this since I leave it running 24/7. You could use a Raspberry Pi or any machine on your home network that you want to leave on since it will be the location you collect data for your dashboard. We will install InfluxDB and Grafana on the Ubuntu virtual machine.

I’ll be using Microsoft Remote Desktop on MacOS to connect to Windows Server 2019. Yes, I’m on MacOS Catalina, a Hackintosh to be specific, using Microsoft Remote Desktop to install Ubuntu on Windows Server. We might break the time-loop continuum.

Step 2. Enable SSH

Access the Ubuntu desktop in Hyper-V. Open the terminal on Ubuntu and install the openssh-server package:

sudo apt update
sudo apt install openssh-server

Enter your password if prompted. Answer Y to complete the package installation.

Verify that SSH is running by typing:

sudo systemctl status ssh

You should see something like this to tell you the service status:

SSH status in Ubuntu 20.04

Enable SSH so it will start next time your reboot:

sudo systemctl enable ssh

Lastly, get your virtual machine IP address by typing:

ip address

I can now close out my remote connection to the server and work from MacOS Terminal to access Ubuntu by SSH.

Step 3. Connect to Ubuntu with SSH

Use a command line tool of your choice to connect to the virtual machine. I’m using MacOS Terminal. Using the user account you created when installing Ubuntu and the virtual machine ip address, type the following:

ssh jeff@192.168.2.144
SSH connection to Ubuntu

Step 4. Install InfluxDB

Add the InfluxData repository with the following commands:

wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/lsb-release
echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

This will add a new source file to our Ubuntu installation. You can verify the file exists or make additional changes by using the following:

sudo nano /etc/apt/sources.list.d/influxdb.list

You should see this:

InfluxData Source

Exit the file by typing Ctrl+X.

Install and start the InfluxDB service with:

sudo apt-get update && sudo apt-get install influxdb
sudo systemctl unmask influxdb.service
sudo systemctl start influxdb

Check that the service is running:

sudo systemctl status influxdb

You should get something like this:

InfluxDB Service Status

Let’s make sure the service starts on the next boot:

sudo systemctl enable influxdb

The InfluxDB service is now installed and running.

Step 5. Configure InfluxDB

First, create an admin user so we can enable authentication for the InfluxDB service. Access InfluxDB like this:

influx

Create the user:

CREATE USER admin WITH PASSWORD 'yourpassword' WITH ALL PRIVILEGES
SHOW USERS
EXIT

We need to make several changes to the configuration of InfluxDB. We do that by editing the InfluxDB config file:

sudo nano /etc/influxdb/influxdb.conf

Remove the # character from these 3 lines under the [http] section and change auth-enabled to true:

enabled = true
bind-address = ":8086"
auth-enabled = true
InfluxDB config file

Write the file by typing Ctrl+O and exit the file by typing Ctrl+X.

Open port 8086 on the firewall. This is crucial or you will not get any data sent to your Influx database.

sudo ufw enable
sudo ufw allow 8086/tcp

Restart the InfluxDB service.

sudo systemctl restart influxdb

Log back into InfluxDB with:

influx -username admin -password yourpassword

Create a database and user to store our data sent from Telegraf.

CREATE DATABASE telegraf
CREATE USER telegraf WITH PASSWORD 'telegrafpassword'
GRANT ALL ON telegraf TO telegraf

I know, I’m using the same name for my database and user. This is a matter of preference, pick something that works for you.

InfluxDB is now ready to receive data!

Step 6. Install Telegraf

Telegraf is the tool we use to gather the metrics and send that data to our InfluxDB database. The important things to realize at this point is we can send data to InfluxDB from anywhere in our homelab, as long as we can use something like Telegraf on that machine/service/vm to do it. Services like pfSense, TrueNas and Unraid all have their own unique ways to send data to InfluxDB as well.

I plan to send data from as many services in my homelab as possible. For now, I’ll start with Windows Server 2019.

This is the same server where I have the VM setup. Open Powershell as Administrator and run the following:

cd ~\Downloads
wget https://dl.influxdata.com/telegraf/releases/telegraf-1.15.2_windows_amd64.zip -outfile telegraf-1.15.2_windows_amd64.zip
unzip .\telegraf-1.15.2_windows_amd64.zip
Expand-Archive -Path telegraf-1.15.2_windows_amd64.zip -DestinationPath 'C:\Program Files'
cd 'C:\Program Files'
Rename-Item telegraf-1.15.2 Telegraf

Telegraf is now downloaded, unzipped and moved to the correct directory. We can now install the service. Run the following in PowerShell:

C:\"Program Files"\Telegraf\telegraf.exe --service install

The Telegraf service is ready for configuration and you should see it now in the Services app. Don’t start it yet.

Telegraf service installed on Windows Server 2019

Now we need to configure Telegraf and tell it to send the data to our Ubuntu VM. Open the configuration file located here: C:\Program Files\Telegraf\telegraf.conf in Notepad or your favorite editor. I’m using Microsoft Visual Studio Code.

Change the following lines under [[outputs.influxdb]] (use the credentials you setup in InfluxDB):

urls = ["http://192.168.2.144:8086"]
database = "telegraf"
username = "telegraf"
password = "YOURPASSWORD"
Telegraf configuration file on Windows Server 2019

Make sure the Windows Performance Counters plugin is configured like your want. I’m leaving the default setup for now. Looks like this:

Windows Performance Counters plugin in Telegraf

That’s it, we are done on Windows Server for now.

Back on MacOS Terminal, check to see if you are receiving data from Telegraf.

influx -username admin -password yourpassword
use telegraf
show measurements
SELECT * FROM win_cpu LIMIT 5
InfluxDB measurements from Windows Server 2019

You can see the data that is being sent!

Note: There is a column titled “host” where you can see the name of the server sending the data.

Step 7. Install Grafana

In MacOS Terminal, let’s install Grafana on our Ubuntu virtual machine and work on our data visualization.

Add the repository to Ubuntu:

sudo apt-get install -y apt-transport-https
sudo apt-get install -y software-properties-common wget
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list

After you add the repository:

sudo apt-get update
sudo apt-get install grafana

Enable Grafana so it will start on reboot and start the service.

sudo systemctl enable grafana-server
sudo systemctl start grafana-server

Check the status of Grafana:

sudo systemctl status grafana-server

Finally, open the port so we can reach the Grafana dashboard.

sudo ufw allow 3000/tcp

Access the Grafana control panel by entering your Ubuntu IP address with port 3000 in your web browser. For example, I use http://192.168.2.144:3000.

The default username is admin. The default password is admin.

Change the password.

You’re in!

Step 8. Configure Grafana

The first thing we need to do in Grafana is add InfluxDB as a Data Source.

Navigate the left menu to Configuration > Data Sources. Click Add Data Source. Choose InfluxDB.

Add the URL http://localhost:8086 to the HTTP section. Add your database name, username and password to the InfluxDB section. Select GET for the HTTP Method.

Grafana Data Source

Now we are ready to build our first Dashboard.

Let’s start with something very simple like system uptime. Create a new dashboard and click the “Add new panel” button. In the panel editor choose the following settings in the query editor:

Query editor for system uptime

Choose Stat for the visualization of the panel. Under the Filed tab, select seconds for the Unit of measure.

That’s it, you have your first panel on the dashboard.

Uptime panel

From here, the sky is the limit! Use the measurements in your query editor to discover all of the data you can display from the server.

You can see below a few more panels have been added for CPU usage, Memory, Network Throughput, etc.

Grafana dashboard in progress

Next Steps

The next step is to start installing Telegraf on virtual machines or other services like Unraid in your homelab and send that data to your InfluxDB. You can create new databases in InfluxDB or just send it all to the the same database and sort it out by the hostname when you add panels to your dashboard in Grafana.

Categories
homelab

Disable Dell r720xd Cooling Response When GPU Is Added

I recently added a Nvidia GTX 970 to my Dell r720xd server. The first thing I noticed was the fans ramped up quite a bit and this system is usually very quiet.

Dell r720xd with Nvidia GTX 970
Dell r720xd with Nvidia GTX 970

Yes, I know I can use IPMI and easily set the fans at a fixed lower rpm. However, I’d rather leave it up to the OS to manage the fan speed, if possible.

It turns out that the server is designed to automatically adjust cooling when third party PCIe cards are added.

You can disable the cooling response logic with this command:

ipmitool -I lanplus -H IPADDRESS -U USERNAME -P PASSWORD raw 0x30 0xce 0x00 0x16 0x05 0x00 0x00 0x00 0x05 0x00 0x01 0x00 0x00

You can enable the cooling response logic with this command:

ipmitool -I lanplus -H IPADDRESS -U USERNAME -P PASSWORD raw 0x30 0xce 0x00 0x16 0x05 0x00 0x00 0x00 0x05 0x00 0x00 0x00 0x00 

To determine the cooling response logic status:

ipmitool -I lanplus -H IPADDRESS -U USERNAME -P PASSWORD raw 0x30 0xce 0x01 0x16 0x05 0x00 0x00 0x00 

The response data looks like this:

16 05 00 00 00 05 00 01 00 00 (Disabled)
16 05 00 00 00 05 00 00 00 00 (Enabled)

A couple notes about this process. Make sure your card, GPU or otherwise, can handle the low airflow. Check temperatures after you disable the fan response. Second, your iDRAC firmware my need to be updated if the command does not work. My r720xd is on version 2.65.65.65 at the time of this post.