Prometheus Adapter for HWiNFO (+ Grafana Dashboard)

Homer

Member
Thanks for your info. After I noticed that the whole GUI uses the clients and not the servers performance I decided to swap the database and grafana to my Pi 3B+ which runs 24/7 anyway. It runs very smooth as well (except for some currently unsolved firewall issue during startup, but that's some different) with an update rate of 1s. Interestingly the CPU+GPU graph is working as well now, either I loaded an older version oder changed something by mistake during the first installationo_O
Currently I only monitor my main PC. Before I try to adapt specific sensors I would like to know how it's possible to monitor e.g. 2 PCs in one graph. I guess that the data must enter the Prometheus database with a PC specific tag/flag. Therefore I guess I have to adapt the PromDapter per PC so be able to load the hwi-values depending on the PC?
 

Kallex

Well-Known Member
The example graph picture is showing my 3 PCs actually :). Prometheus includes by default (or at least my installation does) "instance" information that includes host:port, so you get to aggregate them by default. Just add all the PCs IPs to scrapers and you're good to go.

I've planned to add computerName - category/attribute to the PromDapter, but I'm not sure if its better still to do on Grafana-side of valuemapping... but without it, you should just have "instance" in there to separate the comps regardless.
 

Xælias

New Member
Hi!
So question for you.
I'm going through some of the metrics that I'm interested in adding on my end.
Is it of any use to you to eventually share the diff in the mapping yaml? And if so better do it here or on github?
 

Kallex

Well-Known Member
Yes that would be nice!

I can merge all the customizations in so that they are included in future releases. Here or GitHub is OK, whichever you prefer.
 

Cosandr

New Member
Is there any way to filter by source name? I took a quick look at the source code and it doesn't seem like it's possible. For example I want only metrics from "Aquaero", note that I've renamed the sensors in hwinfo. I can work around it by using something like '(?<MetricName>(Ambient|Delta|Fans|Pump|Water))' but it's kinda ugly and easy to break.
Code:
# HELP hwi_ambient_c Ambient °C - Aquaero
hwi_ambient_c{unit="°C",sensor_type="SENSOR_TYPE_TEMP",sensor="Ambient",source="Aquaero"} 27.8
# HELP hwi_delta_c Delta °C - Aquaero
hwi_delta_c{unit="°C",sensor_type="SENSOR_TYPE_TEMP",sensor="Delta",source="Aquaero"} 4.78
# HELP hwi_fans_rpm Fans RPM - Aquaero
hwi_fans_rpm{unit="RPM",sensor_type="SENSOR_TYPE_NONE",sensor="Fans",source="Aquaero"} 321
# HELP hwi_pump_rpm Pump RPM - Aquaero
hwi_pump_rpm{unit="RPM",sensor_type="SENSOR_TYPE_NONE",sensor="Pump",source="Aquaero"} 1399
# HELP hwi_water_c Water °C - Aquaero
hwi_water_c{unit="°C",sensor_type="SENSOR_TYPE_TEMP",sensor="Water",source="Aquaero"} 32.58
JSON:
[
  {
    "unit": "°C",
    "sensor_type": "SENSOR_TYPE_TEMP",
    "sensor": "Ambient",
    "source": "Aquaero",
    "value": 27.92,
    "valueType": "Double",
    "metadata": {
      "metricName": "Ambient"
    },
    "metric": "hwi_ambient_c"
  },
  {
    "unit": "°C",
    "sensor_type": "SENSOR_TYPE_TEMP",
    "sensor": "Delta",
    "source": "Aquaero",
    "value": 4.44,
    "valueType": "Double",
    "metadata": {
      "metricName": "Delta"
    },
    "metric": "hwi_delta_c"
  },
  {
    "unit": "RPM",
    "sensor_type": "SENSOR_TYPE_NONE",
    "sensor": "Fans",
    "source": "Aquaero",
    "value": 0.0,
    "valueType": "Double",
    "metadata": {
      "metricName": "Fans"
    },
    "metric": "hwi_fans_rpm"
  },
  {
    "unit": "RPM",
    "sensor_type": "SENSOR_TYPE_NONE",
    "sensor": "Pump",
    "source": "Aquaero",
    "value": 1319.0,
    "valueType": "Double",
    "metadata": {
      "metricName": "Pump"
    },
    "metric": "hwi_pump_rpm"
  },
  {
    "unit": "°C",
    "sensor_type": "SENSOR_TYPE_TEMP",
    "sensor": "Water",
    "source": "Aquaero",
    "value": 32.36,
    "valueType": "Double",
    "metadata": {
      "metricName": "Water"
    },
    "metric": "hwi_water_c"
  }
]
 

Kallex

Well-Known Member
Right now it isn't possible, but I'll see what I can do. Initially I didn't consider the metric names being good to just "pass through as-is", but of course when renamed, that's a common case.

I think PromDapter should support renaming as well, and that would further justify the source-based filtering too.
 

Kallex

Well-Known Member
Just for heads up, I'm closing in to adding configurable support for WMI providers; that is tons of metrics available for Windows. Below some examples in Prometheus and JSON formats:

# HELP filesystem FileSystem - Win32_LogicalDisk
filesystem{name="B:",unit="",sensor_type="Win32_LogicalDisk",sensor="FileSystem",source="Win32_LogicalDisk"} NTFS
filesystem{name="C:",unit="",sensor_type="Win32_LogicalDisk",sensor="FileSystem",source="Win32_LogicalDisk"} NTFS
filesystem{name="D:",unit="",sensor_type="Win32_LogicalDisk",sensor="FileSystem",source="Win32_LogicalDisk"} NTFS
filesystem{name="S:",unit="",sensor_type="Win32_LogicalDisk",sensor="FileSystem",source="Win32_LogicalDisk"} NTFS
filesystem{name="T:",unit="",sensor_type="Win32_LogicalDisk",sensor="FileSystem",source="Win32_LogicalDisk"} NTFS
filesystem{name="V:",unit="",sensor_type="Win32_LogicalDisk",sensor="FileSystem",source="Win32_LogicalDisk"} NTFS
filesystem{name="X:",unit="",sensor_type="Win32_LogicalDisk",sensor="FileSystem",source="Win32_LogicalDisk"} NTFS
# HELP freespace FreeSpace - Win32_LogicalDisk
freespace{name="B:",unit="",sensor_type="CIM_LogicalDisk",sensor="FreeSpace",source="Win32_LogicalDisk"} 285440958464
freespace{name="C:",unit="",sensor_type="CIM_LogicalDisk",sensor="FreeSpace",source="Win32_LogicalDisk"} 124438704128
freespace{name="D:",unit="",sensor_type="CIM_LogicalDisk",sensor="FreeSpace",source="Win32_LogicalDisk"} 467827486720
freespace{name="S:",unit="",sensor_type="CIM_LogicalDisk",sensor="FreeSpace",source="Win32_LogicalDisk"} 338795888640
freespace{name="T:",unit="",sensor_type="CIM_LogicalDisk",sensor="FreeSpace",source="Win32_LogicalDisk"} 591394574336
freespace{name="V:",unit="",sensor_type="CIM_LogicalDisk",sensor="FreeSpace",source="Win32_LogicalDisk"} 61769658368
freespace{name="X:",unit="",sensor_type="CIM_LogicalDisk",sensor="FreeSpace",source="Win32_LogicalDisk"} 86263934976

{
"unit": null,
"sensor_type": "Win32_LogicalDisk",
"sensor": "FileSystem",
"source": "Win32_LogicalDisk",
"value": "NTFS",
"valueType": "String",
"metadata": {
"name": "C:"
},
"metric": "filesystem"
},
{
"unit": null,
"sensor_type": "Win32_LogicalDisk",
"sensor": "FileSystem",
"source": "Win32_LogicalDisk",
"value": "NTFS",
"valueType": "String",
"metadata": {
"name": "B:"
},
"metric": "filesystem"
},
{
"unit": null,
"sensor_type": "CIM_LogicalDisk",
"sensor": "FreeSpace",
"source": "Win32_LogicalDisk",
"value": 86263934976,
"valueType": "UInt64",
"metadata": {
"name": "X:"
},
"metric": "freespace"
},
{
"unit": null,
"sensor_type": "CIM_LogicalDisk",
"sensor": "FreeSpace",
"source": "Win32_LogicalDisk",
"value": 61769658368,
"valueType": "UInt64",
"metadata": {
"name": "V:"
},
"metric": "freespace"
}

WMI gets access to all kinds of system stuff... also adding it in eases the path for adding more other providers in later. I needed it myself, but I hope others will like it too :cool: !
 
Top