This is a simple API implemented in C# that runs in a Windows Service and provides real-time hardware monitoring data in JSON formatted output through a http server (running in TCP port 8000). This project was developed to attend to the final project in the CS50x course at edx.org.
- Kept simple to be as lighweight as possible.
- Since its output is JSON formatted, it can be easily consumed by any modern framework like React, Angular, Vue or any language of preference.
- Runs automatically in a Windows Service, so it runs background since bootup
- internal http server
- uses openhardwarelib.dll from openhardwaremonitor project
Cons:
- Since extracting hardware data requires privileged system access, it needs an administrative account on the local machine that will run the service.
Main sources used on development:
- openhardwaremonitor
- Tutorial using openhardware library
- Microsoft documentation - Develop Windows service apps
- Microsoft documentation - HttpListener Class
Build it on Visual Studio (tested on Visual Studio Community edition 2017 and 2019) Note that you'll have to add the openhardwaremonitorlib.dll as a reference before building it. Download it from Official location Install it as a service with the "Developer Command Line tool" using the InstallUtil command: For example
C:\> CD "C:\Users\XYZ\source\repos\hwmonitor\hwmonitor-service\bin\release"
C:\Users\XYZ\source\repos\hwmonitor\hwmonitor-service\bin\release> InstallUtil hwmonitor-service.exe
(Optional) Check if the service was installed properly using Services in the control Panel. Start manually the service the 1st time (using Services in the control panel) or restart the computer, that the service will start automatically. Browse into http://localhost:8000/ to see the data. (Optional) If you are using this service from another location (internet/intranet), the program itself doesn't add an exception in your firewall, so don't forget to add it.
This project will be delivered as an API but next features that will be added could be:
- A front end in some SPA architecture served on its own internal http server
- Some entries in the Windows System Event Log