❄️ lm-sensor based JSON API for server CPU temperature monitoring
The sensors-api
is a lightweight JSON API designed to provide real-time monitoring of CPU temperatures using the lm-sensors
library. This API can be utilized for various applications, including server monitoring dashboards, alert systems, and more.
- Fetches CPU temperature data using
lm-sensors
. - Returns data in a JSON format for easy integration with other applications.
- Supports CORS for cross-origin requests.
To get started, clone the repository and install the dependencies:
git clone [email protected]:mnofresno/sensors-api.git cd sensors-api npm install
To start the server, run the following command:
node main.js
The server will listen on port 8922
. You can access the API at:
- GET / - Retrieves the current CPU temperature data in JSON format.
{ "cpu": { "temperature": { "core_0": 45, "core_1": 46, "core_2": 44, "core_3": 47 } } }
This API supports CORS, allowing you to make requests from different origins. The following headers are set in the response:
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: OPTIONS, GET
Access-Control-Allow-Headers: Content-Type
This project is licensed under the MIT License. See the LICENSE.md file for details.
Contributions are welcome! Please open an issue or submit a pull request for any enhancements or bug fixes.
If you encounter any issues, please report them on the GitHub Issues page.
Mariano Fresno
Email: [email protected]
GitHub: mnofresno
Thanks to the contributors of the lm-sensors
project for providing the necessary tools for monitoring CPU temperatures.