Skip to content

🌡️ lm-sensor based JSON API for server CPU temperature monitoring

License

Notifications You must be signed in to change notification settings

mnofresno/sensors-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sensors-api

❄️ lm-sensor based JSON API for server CPU temperature monitoring

Overview

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.

Features

  • 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.

Installation

To get started, clone the repository and install the dependencies:

git clone [email protected]:mnofresno/sensors-api.git cd sensors-api npm install

Usage

To start the server, run the following command:

node main.js

The server will listen on port 8922. You can access the API at:

http://localhost:8922

API Endpoint

  • GET / - Retrieves the current CPU temperature data in JSON format.

Example Response

{ "cpu": { "temperature": { "core_0": 45, "core_1": 46, "core_2": 44, "core_3": 47 } } }

CORS Support

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

License

This project is licensed under the MIT License. See the LICENSE.md file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any enhancements or bug fixes.

Issues

If you encounter any issues, please report them on the GitHub Issues page.

Author

Mariano Fresno
Email: [email protected]
GitHub: mnofresno

Acknowledgments

Thanks to the contributors of the lm-sensors project for providing the necessary tools for monitoring CPU temperatures.

About

🌡️ lm-sensor based JSON API for server CPU temperature monitoring

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published