Prometheus Adapter for HWiNFO (+ Grafana Dashboard)

n3farious

New Member
I've been running prometheus with node_exporter for all of my linux boxes for a while, and just found your exporter for hwInfo64. Thank you so much @Kallex ... you rock!

As a tiny contribution, I added my UPS info to the yaml:

YAML:
    # UPS
    - '(?<Entity_UPS>)(?<MetricName>UPS Load|Input Voltage|Output Voltage|Charge Level|Estimated Runtime|AC Power|Charging|Discharging)'

That results in:

# HELP hwi_ups_ac_power_yesno UPS AC Power Yes/No - UPS
# HELP hwi_ups_charge_level UPS Charge Level % - UPS
# HELP hwi_ups_charging_yesno UPS Charging Yes/No - UPS
# HELP hwi_ups_discharging_yesno UPS Discharging Yes/No - UPS
# HELP hwi_ups_estimated_runtime_min UPS Estimated Runtime min - UPS
# HELP hwi_ups_input_voltage_v UPS Input Voltage V - UPS
# HELP hwi_ups_output_voltage_v UPS Output Voltage V - UPS
# HELP hwi_ups_ups_load UPS UPS Load % - UPS
# HELP hwi_ups_ups_load_w UPS UPS Load W - UPS

And some actual metrics:

# HELP hwi_ups_ac_power_yesno UPS AC Power Yes/No - UPS
hwi_ups_ac_power_yesno{unit="Yes/No",sensor_type="SENSOR_TYPE_OTHER",sensor="AC Power",source="UPS",host="N3FARIOUS"} 1
# HELP hwi_ups_charge_level UPS Charge Level % - UPS
hwi_ups_charge_level{unit="%",sensor_type="SENSOR_TYPE_USAGE",sensor="Charge Level",source="UPS",host="N3FARIOUS"} 100
# HELP hwi_ups_charging_yesno UPS Charging Yes/No - UPS
hwi_ups_charging_yesno{unit="Yes/No",sensor_type="SENSOR_TYPE_OTHER",sensor="Charging",source="UPS",host="N3FARIOUS"} 0
# HELP hwi_ups_discharging_yesno UPS Discharging Yes/No - UPS
hwi_ups_discharging_yesno{unit="Yes/No",sensor_type="SENSOR_TYPE_OTHER",sensor="Discharging",source="UPS",host="N3FARIOUS"} 0
# HELP hwi_ups_estimated_runtime_min UPS Estimated Runtime min - UPS
hwi_ups_estimated_runtime_min{unit="min",sensor_type="SENSOR_TYPE_OTHER",sensor="Estimated Runtime",source="UPS",host="N3FARIOUS"} 35
# HELP hwi_ups_input_voltage_v UPS Input Voltage V - UPS
hwi_ups_input_voltage_v{unit="V",sensor_type="SENSOR_TYPE_VOLT",sensor="Input Voltage",source="UPS",host="N3FARIOUS"} 118
# HELP hwi_ups_output_voltage_v UPS Output Voltage V - UPS
hwi_ups_output_voltage_v{unit="V",sensor_type="SENSOR_TYPE_VOLT",sensor="Output Voltage",source="UPS",host="N3FARIOUS"} 118
# HELP hwi_ups_ups_load UPS UPS Load % - UPS
hwi_ups_ups_load{unit="%",sensor_type="SENSOR_TYPE_USAGE",sensor="UPS Load",source="UPS",host="N3FARIOUS"} 22
# HELP hwi_ups_ups_load_w UPS UPS Load W - UPS
hwi_ups_ups_load_w{unit="W",sensor_type="SENSOR_TYPE_POWER",sensor="UPS Load",source="UPS",host="N3FARIOUS"} 153.9

I have a CyberPower UPS and am running the PowerPanel Personal. These are the same stats it shows in it's "Current Status" panel.
 

Kallex

Well-Known Member
I've been running prometheus with node_exporter for all of my linux boxes for a while, and just found your exporter for hwInfo64. Thank you so much @Kallex ... you rock!

As a tiny contribution, I added my UPS info to the yaml:

YAML:
    # UPS
    - '(?<Entity_UPS>)(?<MetricName>UPS Load|Input Voltage|Output Voltage|Charge Level|Estimated Runtime|AC Power|Charging|Discharging)'

Very cool addition, thanks a lot!

Hey, I started to make support for Linux (already while ago), unifying the adapter output. The thing is of course there is no HWiNFO for Linux, but that's not the whole big picture. Same as WMI support (also quite far, just been busy elsewhere) the idea was to be able to scrape from various sources to provide "common interface" to prometheus.

But if there is already existing what you mention "node_exporter" in Linux - is there any need to bring "unifying experience to Linux"?

I'm thinking the ability to name metrics and their categorization in one common way, so that the Prometheus + Grafana woudln't need to behave any different regardless of the Linux/Windows/Mac/??? behind the scenes.
 

masterwishx

Member
Very cool addition, thanks a lot!

Hey, I started to make support for Linux (already while ago), unifying the adapter output. The thing is of course there is no HWiNFO for Linux, but that's not the whole big picture. Same as WMI support (also quite far, just been busy elsewhere) the idea was to be able to scrape from various sources to provide "common interface" to prometheus.

But if there is already existing what you mention "node_exporter" in Linux - is there any need to bring "unifying experience to Linux"?

I'm thinking the ability to name metrics and their categorization in one common way, so that the Prometheus + Grafana woudln't need to behave any different regardless of the Linux/Windows/Mac/??? behind the scenes.

Thanks for great tool , im using it in unraid (linux) HWiNFO Home Cluster.json imported to Grafana ,but dont have all values.
like all cpu /package ,psu (added line from forum to *.yaml ) also s.m.a.r.t is no data . also they gone in 192.168.0.101:10445/metrics ,but drive data is present here.
where to look for fix thouse problems?
 

Kallex

Well-Known Member
You can start adding "catch all" setting to PromDapter.yaml

# Catch all - '(?<MetricName>.*)'

Add it as a last entry before Aggregate values. That will catch all the remaining sensors, that weren't catched before. So after that, examine thorougly the /metrics result - it should have everything that's visible in HWiNFO.

Then to fine-tune the result to be more usable, pick the exact sensor names and try to form a proper regex or paste the lines here and I (or someone else) will try to do them for you.
 

n3farious

New Member
Hey, I started to make support for Linux (already while ago), unifying the adapter output. The thing is of course there is no HWiNFO for Linux, but that's not the whole big picture. Same as WMI support (also quite far, just been busy elsewhere) the idea was to be able to scrape from various sources to provide "common interface" to prometheus.

But if there is already existing what you mention "node_exporter" in Linux - is there any need to bring "unifying experience to Linux"?
node_exporter seems to be the most widely used linux collector set for prometheus tsdb. We use a different collector at work, but only because we use a different tsdb. (We have 50k+ nodes, and it is more complicated to scale Prom like that.)

https://github.com/prometheus/node_exporter details everything out in their README.md

I'm certainly no expert, but it seems to capture most all of the metrics that linux exposes.
 

masterwishx

Member
You can start adding "catch all" setting to PromDapter.yaml

# Catch all - '(?<MetricName>.*)'

Add it as a last entry before Aggregate values. That will catch all the remaining sensors, that weren't catched before. So after that, examine thorougly the /metrics result - it should have everything that's visible in HWiNFO.

Then to fine-tune the result to be more usable, pick the exact sensor names and try to form a proper regex or paste the lines here and I (or someone else) will try to do them for you.
i added this line , restarted service,restarted prometheus...
Strange but i think its not added more sensors .... its same metrics like it was befor .
 

Kallex

Well-Known Member
Martin, if you happen to follow this thread, we got an issue that I could use some assistance with.

GitHub Issue About Few Missing Metrics.

The issue is about new RTX 3080 Ti and its additional temps. Could there be anything special why they wouldn't behave alike in Shared Memory Interface? All the other metrics seem to "passthrough" properly, but for some reason those are missing.

I try to replicate with my code too, but as I don't have identical hardware as the user, I might not be able to replicate (I'll see if my own RTX 3080 replicates this).
 

Martin

HWiNFO Author
Staff member
Nothing special with those values, they should be included in shared memory as any other.
So I'm really wondering why this is happening.
 

Kallex

Well-Known Member
Nothing special with those values, they should be included in shared memory as any other.
So I'm really wondering why this is happening.
No problem!

It could very well be something in my own code - just figured to quickly ask you if there was something special with those values. I'll grab newest versions myself and see if I can repro with my RTX 3080.

I'll get back once I can gather more details, thanks for the really swift reply!
 

Kallex

Well-Known Member
It was cleared out, everything worked OK, just pattern matching caused some boggling issues, but it got resolved by the user.
 

n3farious

New Member
Weird.. getting 500 errors starting this morning. When I checked the event viewer for errors at the time of my last data point in grafana, I see the following Warning and two Errors. The service still shows as running, and the port is listening per netstat.

EDIT: Hmm... more concerning, just a reboot fixed it. Any thoughts on cause or where I can look next?

Code:
The description for Event ID 0 from source PromDapterSvc cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event:

Category: PromDapterSvc.Controllers.MetricsController
EventId: 0
ConnectionId: 0HMB46IPN2BG6
RequestId: 0HMB46IPN2BG6:00000001
RequestPath: /metrics/
SpanId: |41073687-4fa6ffe5e714e27d.
TraceId: 41073687-4fa6ffe5e714e27d
ParentId:
ActionId: 64e8a736-be31-43d1-86f1-01089ecc2c95
ActionName: PromDapterSvc.Controllers.MetricsController.Get (PromDapterSvc)

No prefix defined in configuration; defaulting to hwi_


The message resource is present but the message was not found in the message table

Code:
The description for Event ID 0 from source PromDapterSvc cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event:

Category: PromDapterSvc.Controllers.MetricsController
EventId: 0
ConnectionId: 0HMB46IPN2BG6
RequestId: 0HMB46IPN2BG6:00000001
RequestPath: /metrics/
SpanId: |41073687-4fa6ffe5e714e27d.
TraceId: 41073687-4fa6ffe5e714e27d
ParentId:
ActionId: 64e8a736-be31-43d1-86f1-01089ecc2c95
ActionName: PromDapterSvc.Controllers.MetricsController.Get (PromDapterSvc)

Unhandled error

Exception:
System.IO.FileNotFoundException: Unable to find the specified file.
   at System.IO.MemoryMappedFiles.MemoryMappedFile.OpenCore(String mapName, HandleInheritability inheritability, Int32 desiredAccessRights, Boolean createOrOpen)
   at System.IO.MemoryMappedFiles.MemoryMappedFile.OpenCore(String mapName, HandleInheritability inheritability, MemoryMappedFileRights rights, Boolean createOrOpen)
   at System.IO.MemoryMappedFiles.MemoryMappedFile.OpenExisting(String mapName, MemoryMappedFileRights desiredAccessRights, HandleInheritability inheritability)
   at System.IO.MemoryMappedFiles.MemoryMappedFile.OpenExisting(String mapName, MemoryMappedFileRights desiredAccessRights)
   at SensorMonHTTP.HWiNFOProvider..MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at PrometheusProcessor.ServiceProcessor...MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at PromDapterSvc.Controllers.MetricsController..MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at PromDapterSvc.Controllers.MetricsController..MoveNext()


The message resource is present but the message was not found in the message table

Code:
Category: Microsoft.AspNetCore.Server.Kestrel
EventId: 13
ConnectionId: 0HMB46IPN2BG6
RequestId: 0HMB46IPN2BG6:00000001
RequestPath: /metrics/
SpanId: |41073687-4fa6ffe5e714e27d.
TraceId: 41073687-4fa6ffe5e714e27d
ParentId:

Connection id "0HMB46IPN2BG6", Request id "0HMB46IPN2BG6:00000001": An unhandled exception was thrown by the application.

Exception:
System.IO.FileNotFoundException: Unable to find the specified file.
   at System.IO.MemoryMappedFiles.MemoryMappedFile.OpenCore(String mapName, HandleInheritability inheritability, Int32 desiredAccessRights, Boolean createOrOpen)
   at System.IO.MemoryMappedFiles.MemoryMappedFile.OpenCore(String mapName, HandleInheritability inheritability, MemoryMappedFileRights rights, Boolean createOrOpen)
   at System.IO.MemoryMappedFiles.MemoryMappedFile.OpenExisting(String mapName, MemoryMappedFileRights desiredAccessRights, HandleInheritability inheritability)
   at System.IO.MemoryMappedFiles.MemoryMappedFile.OpenExisting(String mapName, MemoryMappedFileRights desiredAccessRights)
   at SensorMonHTTP.HWiNFOProvider..MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at PrometheusProcessor.ServiceProcessor...MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at PromDapterSvc.Controllers.MetricsController..MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at PromDapterSvc.Controllers.MetricsController..MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at lambda_method(Closure , Object )
   at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
 
Last edited:

n3farious

New Member
Efff... ignore the last message. I think it is because of the attached error and 7.x non-pro limitation.
 

Attachments

  • hwinfo-error.PNG
    hwinfo-error.PNG
    62.6 KB · Views: 5

elvn

New Member
You can start adding "catch all" setting to PromDapter.yaml

# Catch all - '(?<MetricName>.*)'

Add it as a last entry before Aggregate values. That will catch all the remaining sensors, that weren't catched before. So after that, examine thorougly the /metrics result - it should have everything that's visible in HWiNFO.

Then to fine-tune the result to be more usable, pick the exact sensor names and try to form a proper regex or paste the lines here and I (or someone else) will try to do them for you.

That is great as it would allow me to capture the memory junction temperature sensor for the 3000 series gpus (esp. 3080/3090 because it runs very hot on them).

I've been running prometheus with node_exporter for all of my linux boxes for a while, and just found your exporter for hwInfo64. Thank you so much @Kallex ... you rock!

As a tiny contribution, I added my UPS info to the yaml:

YAML:
    # UPS
    - '(?<Entity_UPS>)(?<MetricName>UPS Load|Input Voltage|Output Voltage|Charge Level|Estimated Runtime|AC Power|Charging|Discharging)'

That results in:

# HELP hwi_ups_ac_power_yesno UPS AC Power Yes/No - UPS
# HELP hwi_ups_charge_level UPS Charge Level % - UPS
# HELP hwi_ups_charging_yesno UPS Charging Yes/No - UPS
# HELP hwi_ups_discharging_yesno UPS Discharging Yes/No - UPS
# HELP hwi_ups_estimated_runtime_min UPS Estimated Runtime min - UPS
# HELP hwi_ups_input_voltage_v UPS Input Voltage V - UPS
# HELP hwi_ups_output_voltage_v UPS Output Voltage V - UPS
# HELP hwi_ups_ups_load UPS UPS Load % - UPS
# HELP hwi_ups_ups_load_w UPS UPS Load W - UPS

And some actual metrics:

# HELP hwi_ups_ac_power_yesno UPS AC Power Yes/No - UPS
hwi_ups_ac_power_yesno{unit="Yes/No",sensor_type="SENSOR_TYPE_OTHER",sensor="AC Power",source="UPS",host="N3FARIOUS"} 1
# HELP hwi_ups_charge_level UPS Charge Level % - UPS
hwi_ups_charge_level{unit="%",sensor_type="SENSOR_TYPE_USAGE",sensor="Charge Level",source="UPS",host="N3FARIOUS"} 100
# HELP hwi_ups_charging_yesno UPS Charging Yes/No - UPS
hwi_ups_charging_yesno{unit="Yes/No",sensor_type="SENSOR_TYPE_OTHER",sensor="Charging",source="UPS",host="N3FARIOUS"} 0
# HELP hwi_ups_discharging_yesno UPS Discharging Yes/No - UPS
hwi_ups_discharging_yesno{unit="Yes/No",sensor_type="SENSOR_TYPE_OTHER",sensor="Discharging",source="UPS",host="N3FARIOUS"} 0
# HELP hwi_ups_estimated_runtime_min UPS Estimated Runtime min - UPS
hwi_ups_estimated_runtime_min{unit="min",sensor_type="SENSOR_TYPE_OTHER",sensor="Estimated Runtime",source="UPS",host="N3FARIOUS"} 35
# HELP hwi_ups_input_voltage_v UPS Input Voltage V - UPS
hwi_ups_input_voltage_v{unit="V",sensor_type="SENSOR_TYPE_VOLT",sensor="Input Voltage",source="UPS",host="N3FARIOUS"} 118
# HELP hwi_ups_output_voltage_v UPS Output Voltage V - UPS
hwi_ups_output_voltage_v{unit="V",sensor_type="SENSOR_TYPE_VOLT",sensor="Output Voltage",source="UPS",host="N3FARIOUS"} 118
# HELP hwi_ups_ups_load UPS UPS Load % - UPS
hwi_ups_ups_load{unit="%",sensor_type="SENSOR_TYPE_USAGE",sensor="UPS Load",source="UPS",host="N3FARIOUS"} 22
# HELP hwi_ups_ups_load_w UPS UPS Load W - UPS
hwi_ups_ups_load_w{unit="W",sensor_type="SENSOR_TYPE_POWER",sensor="UPS Load",source="UPS",host="N3FARIOUS"} 153.9

I have a CyberPower UPS and am running the PowerPanel Personal. These are the same stats it shows in it's "Current Status" panel.

Thanks for that. I have a cyberpower UPS (..but I also have an APC).
 
Top