SkillAgentSearch skills...

OhmGraphite

Expose hardware sensor data to Graphite / InfluxDB / Prometheus / Postgres / Timescaledb

Install / Use

/learn @nickbabcock/OhmGraphite
About this skill

Quality Score

0/100

Category

Operations

Supported Platforms

Universal

README

CI

OhmGraphite

OhmGraphite is a Windows service that exposes hardware sensor data to a metric store, allowing one to create informative and beautiful dashboards in Grafana or another time series UI:

dashboard

The above dashboard captures:

  • Power consumption of the CPU and GPU
  • CPU voltages and frequencies
  • Load breakdown on individual GPU components
  • CPU, GPU, disk, and motherboard temperature readings
  • Disk activity, space remaining, and error monitoring
  • Fan speed
  • Network consumption

Supported metric stores:

Hardware support is provided through LibreHardwareMonitor. Since detected sensors is hardware dependent, one can use the LibreHardwareMonitor GUI to preview a subset of metrics that will be exported by OhmGraphite. If a GUI of hardware sensors is all that is desired, and the thought of running and configuring Grafana and a metric store sounds overwhelming, I'd recommend HWINFO.

Installation

  • To allow OhmGraphite access to sensors like CPU temperature, wattage, and frequency: install PawnIO. OhmGraphite works without PawnIO, but will emit limited data.
  • Create a directory that will be the home base for OhmGraphite (I use C:\Apps\OhmGraphite).
  • Download the latest zip and extract to our directory.
  • Update app configuration (located at OhmGraphite.exe.config). See configs for Graphite, InfluxDB, Prometheus, Timescale / Postgres
  • Run as Administrator: Open PowerShell or Command Prompt
  • To install the app .\OhmGraphite.exe install. The command will install OhmGraphite as a Windows service (so you can manage it with your favorite powershell commands or services.msc)
  • To start the app after installation: .\OhmGraphite.exe start or your favorite Windows service management tool
  • If immediately installing an app as an administrator is unnerving, OhmGraphite can be ran interactively with .\OhmGraphite.exe run. Note that running as a regular user will limit the number of sensors OhmGraphite can report on.

Congrats! Installation is done and you'll start seeing metrics flowing into your desired metric store.

Upgrades

  • Stop OhmGraphite service .\OhmGraphite.exe stop
  • Unzip latest release and copy OhmGraphite.exe to your installation directory.
  • Start OhmGraphite service .\OhmGraphite.exe start

Uninstall

  • Stop OhmGraphite service .\OhmGraphite.exe stop
  • Run uninstall command .\OhmGraphite.exe uninstall
  • Remove files

Configuration

App configuration is located in the installation directory at OhmGraphite.exe.config.

Config updates require an app restart to take effect.

Graphite Configuration

The config below polls our hardware every 5 seconds and sends the results to a graphite server listening on localhost:2003.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="host" value="localhost" />
    <add key="port" value="2003" />
    <add key="interval" value="5" />
    <add key="tags" value="false" />
  </appSettings>
</configuration>

Starting with Graphite v1.1.0, Graphite supports tags (similar to InfluxDB's tags). When enabled in OhmGraphite the data format switches from <name> <value> <timestamp> to <name>;tag1=a;tag2=b <value> <timestamp>. Since tags are such a new feature, OhmGraphite has it disabled by default to prevent cumbersome usage with Graphite 0.9 and 1.0 installations.

Examples of types of tags used (same for InfluxDB):

  • sensor_type: temperature, load, watts, rpms
  • hardware_type: cpu, gpu, hdd
  • host: my-pc
  • app: ohm
  • hardware: Nvidia GTX 970, Intel i7 6700k
  • raw_name (sensor name): CPU DRAM, CPU graphics

For any serious interest in tags, make sure to use external db like postgres, mysql, or redis, as sqlite won't cut it.

InfluxDB Configuration

Graphite is the default export style, but if you're an InfluxDB user you can change the type to influxdb and fill out InfluxDB specific options:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="type" value="influxdb" />
    <add key="interval" value="5" />
    <add key="influx_address" value="http://localhost:8086" />
    <add key="influx_db" value="mydb" />
<!--
    <add key="influx_user" value="myuser" />
    <add key="influx_password" value="mypassword" />
    <add key="interval" value="5" />
-->
  </appSettings>
</configuration>

If OhmGraphite will be connecting to InfluxDB 2, the configuration will need to be changed accordingly.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="type" value="influx2" />
    <add key="influx2_address" value="http://localhost:8086" />
    <add key="influx2_org" value="myorg" />
    <add key="influx2_bucket" value="mydb" />
    <add key="influx2_token" value="thisistheinfluxdbtoken" />
    <add key="interval" value="5" />
  </appSettings>
</configuration>

Prometheus Configuration

Configuring the Prometheus exporter will create a server that listens on prometheus_port. Instead of creating outbound data like the other exporters, OhmGraphite's Prometheus config creates inbound data. OhmGraphite will only poll the hardware sensors when scraped by the Prometheus service.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="type" value="prometheus" />
    <add key="prometheus_port" value="4445" />
    
    <!-- This is the host that OhmGraphite listens on.
         `*` means that it will listen on all interfaces.
         Consider restricting to a given IP address -->
    <add key="prometheus_host" value="*" />
    <add key="prometheus_path" value="metrics/" /> 
  </appSettings>
</configuration>

Then you'll need add the OhmGraphite instance to your Prometheus config. This can be done with the method of your choosing but for the sake of example here is a possible prometheus.yml:

global:
  scrape_interval: 15s
scrape_configs:
  - job_name: 'ohmgraphite'
    static_configs:
    - targets: ['10.0.0.200:4445']

In the above example, the Prometheus server and OhmGraphite are not on the same machine, so Prometheus accesses OhmGraphite through the machine that is hosting OhmGraphite via the IP address (10.0.0.200).

If the Prometheus service accessing OhmGraphite is not on the same machine, one may have to enable the port through the windows firewall.

Here's one example of enabling it in powershell. Note that there are further ways to configure the firewall for additional tightening of access (ie: only allow certain IPs to connect).

New-NetFirewallRule -DisplayName "Allow port 4445 for OhmGraphite" -Direction Inbound -LocalPort 4445 -Protocol TCP -Action Allow

Prometheus HTTPS Configuration

This section will walkthrough setting up HTTPS communication with a self signed certificate between OhmGraphite and Prometheus:

Execute the instructions below with an admin powershell terminal to generate the certificate, import it into the machine, and then bind the certificate to the configured port.

# Create a new self signed certificate with a subject equal to host used to
# access OhmGraphite. If an IP address is used to access OhmGraphite,
# you'll need the IPAddress field, otherwise the `TextExtension` param can be
# replaced with the DnsName param.
$params = @{
  FriendlyName = 'OhmGraphite'
  Subject = '10.0.0.200'
  TextExtension = @('2.5.29.17={text}&IPAddress=10.0.0.200')
}
$cert = New-SelfSignedCertificate @params
$thumb = $cert.Thumbprint

# Export and then import our cert into Windows certificate store
Export-Certificate -Cert $cert -FilePath ohmgraphite.cer
Import-Certificate -FilePath .\ohmgraphite.cer -CertStoreLocation Cert:\LocalMachine\Root

# Bind our cert to the port OhmGraphite is listening on
netsh http add sslcert ipport=0.0.0.0:4445 certhash=$thumb

Enable HTTPS in OhmGraphite.exe.config with prometheus_https:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="type" value="prometheus" />
    <add key="prometheus_port" value="4445" />
    <add key="prometheus_host" value="*" />
    <add key="prometheus_https" value="true" />
  </appSettings>
</configuration>

With OhmGraphite configured, the prometheus server is next. In order to have prometheus verify against a self signed certificate, the certificate must be converted into a format prometheus understands:

# Linux:
openssl x509 -inform der -in ohmgraphite.cer -out ohmgraphite.pem

# Windows:
# certutil -encode .\ohmgraphite.cer .\ohmgraphite.pem

Then update the prometheus config to expect our certificate:

   - job_name: 'ohmgraphite'
+    scheme: https
+    tls_config:
+  
View on GitHub
GitHub Stars529
CategoryOperations
Updated4d ago
Forks46

Languages

C#

Security Score

85/100

Audited on Mar 29, 2026

No findings