diff --git a/README.md b/README.md new file mode 100644 index 0000000..af8798a --- /dev/null +++ b/README.md @@ -0,0 +1,176 @@ +# Open Hardware Monitor Client + +A utility to fetch metrics from [Open Hardware Monitor](https://openhardwaremonitor.org/) instances by using it's web service. +It currently only supports two commands; printing to a console and a prometheus exporter. + +## Stability + +This package is under development and should not considered stable at this time. + +## Install + +This package is `go get`able by running: + +```bash +$ go get git.buddy.wtf/buddy/open-hardware-monitor-client/cmd/ohwm-client +``` + +## Usage + +``` +$ ohwm-client help +NAME: + ohwm-client - A new cli application + +USAGE: + ohwm-client [flags] [flags] + +DESCRIPTION: + Open Hardware Manager Client + +COMMANDS: + print pretty prints api result + export runs http exporter for prometheus + help, h Shows a list of commands or help for one command + +GLOBAL OPTIONS: + --host value open hardware monitor host [OSHW_HOST] (default: "127.0.0.1:8085") [$OHWM_HOST] + --scheme value open hardware monitor scheme (http/https) (default: "http") [$OHWM_SCHEME] + --path value open hardware monitor path (ie /data.json) (default: "/data.json") [$OHWM_PATH] + --help, -h show help +``` + +### Prometheus Exporter + +The prometheus exporter converts the JSON format from the Open Hardware Monitor to the [OpenMetrics](https://openmetrics.io/) format used by prometheus. +The server responds to the /metrics endpoint. + +``` +$ ohwm-client export --http :9111 +2019/10/01 18:43:38 listen on: :9111 +2019/10/01 18:43:50 GET /metrics +``` + +``` +$ curl localhost:9111/metrics +# HELP ohwm_host_cpu_load_cpu_core_1 ohwm_host_cpu_load_cpu_core_1 +# TYPE ohwm_host_cpu_load_cpu_core_1 gauge +ohwm_host_cpu_load_cpu_core_1{computer="TOY",cpu="Intel Core i7-6700K",unit="load"} 0 +# HELP ohwm_host_cpu_load_cpu_core_2 ohwm_host_cpu_load_cpu_core_2 +# TYPE ohwm_host_cpu_load_cpu_core_2 gauge +ohwm_host_cpu_load_cpu_core_2{computer="TOY",cpu="Intel Core i7-6700K",unit="load"} 0 +# HELP ohwm_host_cpu_load_cpu_core_3 ohwm_host_cpu_load_cpu_core_3 +# TYPE ohwm_host_cpu_load_cpu_core_3 gauge +ohwm_host_cpu_load_cpu_core_3{computer="TOY",cpu="Intel Core i7-6700K",unit="load"} 0 +# HELP ohwm_host_cpu_load_cpu_core_4 ohwm_host_cpu_load_cpu_core_4 +# TYPE ohwm_host_cpu_load_cpu_core_4 gauge +ohwm_host_cpu_load_cpu_core_4{computer="TOY",cpu="Intel Core i7-6700K",unit="load"} 0 +# HELP ohwm_host_cpu_load_cpu_total ohwm_host_cpu_load_cpu_total +# TYPE ohwm_host_cpu_load_cpu_total gauge +ohwm_host_cpu_load_cpu_total{computer="TOY",cpu="Intel Core i7-6700K",unit="load"} 0 +# HELP ohwm_host_cpu_mhz_bus_speed ohwm_host_cpu_mhz_bus_speed +# TYPE ohwm_host_cpu_mhz_bus_speed gauge +ohwm_host_cpu_mhz_bus_speed{computer="TOY",cpu="Intel Core i7-6700K",unit="clock"} 100 +# HELP ohwm_host_cpu_mhz_cpu_core_1 ohwm_host_cpu_mhz_cpu_core_1 +# TYPE ohwm_host_cpu_mhz_cpu_core_1 gauge +ohwm_host_cpu_mhz_cpu_core_1{computer="TOY",cpu="Intel Core i7-6700K",unit="clock"} 4008 +# HELP ohwm_host_cpu_mhz_cpu_core_2 ohwm_host_cpu_mhz_cpu_core_2 +# TYPE ohwm_host_cpu_mhz_cpu_core_2 gauge +ohwm_host_cpu_mhz_cpu_core_2{computer="TOY",cpu="Intel Core i7-6700K",unit="clock"} 4008 +# HELP ohwm_host_cpu_mhz_cpu_core_3 ohwm_host_cpu_mhz_cpu_core_3 +# TYPE ohwm_host_cpu_mhz_cpu_core_3 gauge +ohwm_host_cpu_mhz_cpu_core_3{computer="TOY",cpu="Intel Core i7-6700K",unit="clock"} 4008 +# HELP ohwm_host_cpu_mhz_cpu_core_4 ohwm_host_cpu_mhz_cpu_core_4 +# TYPE ohwm_host_cpu_mhz_cpu_core_4 gauge +ohwm_host_cpu_mhz_cpu_core_4{computer="TOY",cpu="Intel Core i7-6700K",unit="clock"} 4008 +[...] +``` + +### Print + +Print will write the results to the console. Example usage: + +``` +$ ohwm-client print +Sensor: Value (Min - Max) + TOY + Gigabyte Z170MX-Gaming 5 + ITE IT8628E + Voltages + Voltage #1: 0.804 V (0.492 V - 1.392 V) + Voltage #2: 2.016 V (1.968 V - 2.016 V) + Voltage #3: 2.028 V (1.968 V - 2.028 V) + Voltage #4: 2.004 V (1.968 V - 2.004 V) + Voltage #5: 0.012 V (0.012 V - 0.012 V) + Voltage #6: 1.068 V (1.056 V - 1.068 V) + Voltage #7: 1.200 V (1.188 V - 1.200 V) + Standby +3.3V: 3.384 V (3.384 V - 3.384 V) + VBat: 3.168 V (3.168 V - 3.168 V) + Temperatures + Temperature #1: 34.0 °C (27.0 °C - 49.0 °C) + Temperature #2: 47.0 °C (31.0 °C - 59.0 °C) + Temperature #3: 30.0 °C (24.0 °C - 70.0 °C) + Fans + Fan #1: 1573 RPM (1329 RPM - 2744 RPM) + Fan #2: 729 RPM (549 RPM - 1776 RPM) + Fan #3: 773 RPM (611 RPM - 1000 RPM) + Fan #4: 748 RPM (547 RPM - 975 RPM) + Fan #5: 817 RPM (638 RPM - 1078 RPM) + Controls + Fan Control #1: - + Fan Control #2: - + Fan Control #3: - + Intel Core i7-6700K + Clocks + Bus Speed: 100 MHz (100 MHz - 100 MHz) + CPU Core #1: 4008 MHz (802 MHz - 4208 MHz) + CPU Core #2: 4008 MHz (802 MHz - 4209 MHz) + CPU Core #3: 4008 MHz (802 MHz - 4209 MHz) + CPU Core #4: 4008 MHz (802 MHz - 4208 MHz) + Temperatures + CPU Core #1: 25.0 °C (18.0 °C - 72.0 °C) + CPU Core #2: 26.0 °C (20.0 °C - 76.0 °C) + CPU Core #3: 22.0 °C (16.0 °C - 69.0 °C) + CPU Core #4: 22.0 °C (16.0 °C - 63.0 °C) + CPU Package: 29.0 °C (24.0 °C - 76.0 °C) + Load + CPU Total: 0.2 % (0.0 % - 89.1 %) + CPU Core #1: 0.0 % (0.0 % - 91.4 %) + CPU Core #2: 0.8 % (0.0 % - 89.1 %) + CPU Core #3: 0.0 % (0.0 % - 87.5 %) + CPU Core #4: 0.0 % (0.0 % - 91.4 %) + Powers + CPU Package: 12.4 W (4.5 W - 70.1 W) + CPU Cores: 6.0 W (2.3 W - 67.3 W) + CPU Graphics: 0.0 W (0.0 W - 0.0 W) + CPU DRAM: 1.0 W (0.4 W - 3.4 W) + Generic Memory + Load + Memory: 29.4 % (18.4 % - 60.5 %) + Data + Used Memory: 4.7 GB (2.9 GB - 9.6 GB) + Available Memory: 11.3 GB (6.3 GB - 13.0 GB) + NVIDIA GeForce GTX 980 Ti + Clocks + GPU Core: 135 MHz (135 MHz - 1392 MHz) + GPU Memory: 405 MHz (405 MHz - 3506 MHz) + GPU Shader: 270 MHz (270 MHz - 2784 MHz) + Temperatures + GPU Core: 36.0 °C (30.0 °C - 82.0 °C) + Load + GPU Core: 0.0 % (0.0 % - 100.0 %) + GPU Memory Controller: 0.0 % (0.0 % - 55.0 %) + GPU Video Engine: 0.0 % (0.0 % - 52.0 %) + GPU Memory: 10.2 % (8.0 % - 98.9 %) + Fans + GPU: 0 RPM (0 RPM - 3867 RPM) + Controls + GPU Fan: 0.0 % (0.0 % - 63.0 %) + Data + GPU Memory Free: 5519.7 MB (65.8 MB - 5651.3 MB) + GPU Memory Used: 624.3 MB (492.7 MB - 6078.2 MB) + GPU Memory Total: 6144.0 MB (6144.0 MB - 6144.0 MB) + SAMSUNG MZHPU512HCGL-00000 + Load + Used Space: 56.1 % (55.8 % - 56.9 %) +```