hexagon-oss / openhardwaremonitor

Open Hardware Monitor - a tool for monitoring hardware performance. Includes support for various temperature sensors, disk I/O ratings and power consumption.
Mozilla Public License 2.0
188 stars 21 forks source link

WMI #42

Open donagrejja opened 1 year ago

donagrejja commented 1 year ago

Hi =)

Nice job on the bugfixes and additional hardware support of this application =)

I am just wondering if it's possible to maybe add WMI like before but as an alternative plugin or such ?

I know that there was a userbase of the original product that are using WMI together with desktopinfo (https://www.glenn.delahoy.com/desktopinfo/)

And ofc I am one of those using WMI queries to lookup hardware information =) but I can't get it to display newer hardware due to WMI being deprecated and older versions with WMI not supporting the hardware ;)

Anyway. Great job !

pgrawehr commented 1 year ago

There where two reasons WMI support has been removed:

Therefore we added a new, web-request based API to replace WMI. I am aware this might break some usage scenarios, but I was assuming it is not so difficult to switch an application to the new API.

Isn't this desktopinfo tool doing the same thing? Or why would they need to work together?

RealKodijack commented 1 year ago

Getting rid of WMI was great, but how does one query the API?

pgrawehr commented 1 year ago

@RealKodijack Apparently, I never documented it.

When the web server is running, you can point your browser at http://localhost:8086 to see a web interface. Other than that, the following Json end points are implemented:

/api/available

Returns "true" (or an error if not)

/api/version

Returns the version of the server

/api/rootnode

Returns a json with the sensor tree and all the values

/api/nodes/{NodeId}

Returns a json with just the information for the given node

So the basic idea is that you would be querying /api/rootnode first to get the list of nodes, and then query /api/nodes/... to get an update. You will need to regularly query the root node again, otherwise you will not be notified of hardware changes (e.g. new USB sticks connected).

If you happen to use .NET, there's a reference implementation for a client in https://github.com/dotnet/iot/tree/main/src/devices/HardwareMonitor.

RealKodijack commented 1 year ago

Awesome, thanks for the quick reply. Already dug the info out of the code myself, but I'm surely not the first nor the last to wonder :-)