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:
I used the default settings and clicked “Apply”.
Step 2. Install Telegraf Docker
Next, install the Telegraf docker (choose the one with the green thumb):
I’m also going to leave the default settings for the Telegraf installation:
You should see both docker containers under the docker section 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.
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:
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.
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.
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.
deb http://ftp.debian.org/debian stable main contrib non-free
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:
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.
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.
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:
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
Step 4. Install InfluxDB
Add the InfluxData repository with the following commands:
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:
The Telegraf service is ready for configuration and you should see it now in the Services app. Don’t start it yet.
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):
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.
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:
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.
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.
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.
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.
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:
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.