- First, Install lm_sensors. For Ubuntu, execute:
sudo apt-get install lm-sensors- Configuration: Run the following command to detect and configure hardware sensors.
sudo sensors-detectTo integrate hardware sensor data from tools like lm_sensors, with Prometheus for monitoring, a file is created which will translate data into a format Prometheus can scrape. Since Prometheus works by pulling metrics from HTTP endpoints, the goal is to expose the sensor data as HTTP endpoints.
A script is written that outputs the sensor data in a Prometheus-friendly format (See File Here).
To make the data accessible to Prometheus, the script is served it over HTTP. The simple solution is to use Python's HTTP server functionality. See here basic wrapper script that serves exporter's output.
Add a new job to Prometheus configuration (prometheus.yml) to scrape this custom exporter:
scrape_configs:
- job_name: 'sensors'
static_configs:
- targets: ['your_server_ip:8000']###2.4. Restart Restart HTTP server script and Prometheus to apply the changes.