Beautiful dashboards for your home components, now with GPU and power usage
Update: 2017-11-01: I’ve opensourced this utility as OhmGraphite, It can be ran as a CLI app or Windows service. The code showcased here demonstrates how to get a minimal example running. See the repo for a more production worthy approach!
Hot on the heels of Monitoring Window’s system metrics with Grafana are two fixes for the dashboard. Graphs about the GPU and power usage were missing from the dashboard, but I’m happy to state that I’ve fixed this with the help from Open Hardware Monitor, which is an open source application/library for reading sensor data from computer components. I was able to utilize this library to send this data into graphite to be displayed on my grafana dashboards!
The plan is to create a simple Windows service that will run on boot and feed data into graphite.
Open Hardware Monitor WMI
Open Hardware Monitor publishes all sensor data to WMI, but since I’m not familiar with WMI, it sounds like another layer of indirection from the hardware. I’d also like to not run the application, which I’m presuming is what is required to send to WMI. Not to mention I’d still need to write the code to export WMI metrics to graphite. Since graphite has such a simple easy API for feeding data into it, writing custom code will be the quickest way to see the data.
Open Hardware Monitor Library
I’ve mentioned that Open Hardware Monitor has a library, but did I mention that library is out of date? To get the widest range of hardware compatibility, we’ll need to work off the master branch in the source code. It’s inconvenient, but not a show stopper, as we’ll just need to reference our local build in our code.
Open Hardware Monitor is great, but there are some holes. My Asus Z170 Pro Gaming motherboard has zero sensors registered. There looks to be an outstanding issue for this. The following pull request shows fan speeds, but not much else. I suspect there must be other hardware configurations where sensors are not detected, so user beware.
Once my motherboard support is added to the library I’ll be able to add panels showing voltages, temperatures, and fan speeds across multiple components.
Since Open Hardware Monitor is written in C#, our service will also. Our code uses some C# features, so some syntax may look new to C# veterans (I’m certainly still getting used to it).
And can’t forget the bit of code that is used to install our service:
And the command to install.
If you want to run the code interactively, make sure to run it as administrator for CPU power and temperature.
I’m calling the code “ohm-graphite”. It has the potential to be packaged as a library or application for others, but since I’m still testing the waters (I mean, I wrote the code in a couple hours). So for other graphite + grafana + windows power users (and how many those are out there?), feel free to snag the code under MIT.