1
0

Тайлбар байхгүй

Nick Babcock fab48c7224 Merge pull request #58 from nickbabcock/dependabot/nuget/prometheus-net-3.1.1 6 жил өмнө
LibreHardwareMonitor @ 98969ebc3e 45cea83c66 Bump Librehardware to latest 6 жил өмнө
OhmGraphite fab48c7224 Merge pull request #58 from nickbabcock/dependabot/nuget/prometheus-net-3.1.1 6 жил өмнө
OhmGraphite.Test 361f22dd62 Prometheus tests to listen on different ports 6 жил өмнө
assets f62eb8bbb2 Move test assets into assets folder 6 жил өмнө
ci f036024697 More reliable ci 6 жил өмнө
.gitattributes 8c87b003f4 Add .gitignore and .gitattributes. 7 жил өмнө
.gitignore 8c87b003f4 Add .gitignore and .gitattributes. 7 жил өмнө
.gitmodules f439846293 Working version of ohm export to graphite 7 жил өмнө
.travis.yml d9cce9c53d Travis ci has older docker compose installed 6 жил өмнө
CHANGELOG.md 42ab3166f1 Elaborate on name_lookup config option in changelog 6 жил өмнө
LICENSE.txt 62a0c572e7 Add license and readme 7 жил өмнө
OhmGraphite.sln 8b42aa2fcf Add tests for culture invariant formatting 7 жил өмнө
README.md 9437fba1f9 Add DNS hostname config option 6 жил өмнө
appveyor.yml 4613e47327 Remove integration tests from appveyor 6 жил өмнө
dashboard-example.json 8a92060027 ADD: Fan dummy FIX: Color/Unit 6 жил өмнө
docker-compose.yml f036024697 More reliable ci 6 жил өмнө

README.md

Build status

OhmGraphite

OhmGraphite takes the hard work of extracting hardware sensors from Open Hardware Monitor (technically LibreHardwareMonitor for most up to date hardware) and exports the data in a graphite (or InfluxdDB / Prometheus / TimescaleDB) compatible format. OhmGraphite is for those missing any of the following in Grafana or (other time series UI):

  • Breakdown of GPU utilization
  • Fan speed
  • Temperature for hard drives, CPU cores, GPU, Motherboard
  • Voltage readings

Who's this for?

  • People who are familiar with Graphite (or InfluxDB / Prometheus / TimescaleDB) / Grafana and may have an instance running on their home or cloud server. If you're not familiar with those applications, it may be overwhelming to setup and maintain them. If you're just looking for a UI for hardware sensors, I'd recommend HWINFO
  • People who know how to execute commands on Windows Command Prompt or other terminal
  • People who like lightweight (8MB of RAM and neglible CPU usage), portable (can run off usb), and straightforward applications

System Recommendations

  • Windows
  • .NET v4.6.1. If you have Windows 10 you are all set. If not, you may have to download a more recent version.
  • Administrator privileges

Introduction

OhmGraphite functions as a console app or a Windows service that periodically polls the hardware. My recommendation is that even though OhmGraphite can be run via Mono / Docker, many hardware sensors aren't available in those modes.

I use this every day to create beautiful dashboards. Keep in mind, Open Hardware Monitor supported components will determine what metrics are available. Below are graphs / stats made with OhmGraphite (couple of the panels are complemented with telegraf as demonstrated in Monitoring Windows system metrics with grafana)

dashboard

Getting Started (Windows)

  • 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) using either the Graphite config or InfluxDB config
  • This config can be updated in the future, but will require a restart of the app for effect.
  • The app can be ran interactively by executing .\OhmGraphite.exe run. Executing as administrator will most likely increase the number of sensors found (OhmGraphite will log how many sensors are found).
  • 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

Hostname Resolution

When OhmGraphite sends metrics to the desired sink, it includes the computers hostname for additional context to allow scenarios where one has a grafana template variable based on hostname. There two possible ways for OhmGraphite to resolved the hostname: NetBIOS (the default) and DNS. It's hard to say exactly how a machine's NetBIOS name and internet host name will differ, but to give an example, a NetBIOS name of TINI can have a host name of Tini.

To switch to DNS hostname resolution, update the configuration to include name_lookup

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="name_lookup" value="dns" />
  </appSettings>
</configuration>

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>

Prometheus Configuration

The Prometheus will create a server that listens on prometheus_port. The Prometheus configuration does not routinely poll the sensor instead it only polls them when a Prometheus server requests data.

<?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="*" />
  </appSettings>
</configuration>

TimescaleDB Configuration

One can configure OhmGraphite to send to Timescale with the following (configuration values will differ depending on your environment):

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="type" value="timescale" />
    <add key="timescale_connection" value="Host=vm-ubuntu;Username=ohm;Password=123456;Database=postgres" />
    <add key="timescale_setup" value="false" />
  </appSettings>
</configuration>

By leaving timescale_setup to false (the default) OhmGraphite will be expecting the following table structure to insert into:

CREATE TABLE IF NOT EXISTS ohm_stats (
   time TIMESTAMPTZ NOT NULL,
   host TEXT,
   hardware TEXT,
   hardware_type TEXT,
   identifier TEXT,
   sensor TEXT,
   sensor_type TEXT,
   sensor_index INT,
   value REAL
);

Then give the ohm user appropriate permissions:

CREATE USER ohm WITH PASSWORD 'xxx';
GRANT INSERT ON ohm_stats TO ohm;

In this mode, Postgres is supported.

If timescale_setup is true then OhmGraphite will create the following schema, so make sure the user connecting has appropriate permissions

CREATE TABLE IF NOT EXISTS ohm_stats (
   time TIMESTAMPTZ NOT NULL,
   host TEXT,
   hardware TEXT,
   hardware_type TEXT,
   identifier TEXT,
   sensor TEXT,
   sensor_type TEXT,
   sensor_index INT,
   value REAL
);

SELECT create_hypertable('ohm_stats', 'time', if_not_exists => TRUE);
CREATE INDEX IF NOT EXISTS idx_ohm_host ON ohm_stats (host);
CREATE INDEX IF NOT EXISTS idx_ohm_identifier ON ohm_stats (identifier);

Currenlty the schema and the columns are not configurable.

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