Add info metric and prep release
This commit is contained in:
parent
213d2e05b5
commit
c39632d9a1
|
@ -0,0 +1,21 @@
|
|||
# Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
### Changed
|
||||
|
||||
### Deprecated
|
||||
|
||||
### Removed
|
||||
|
||||
### Fixed
|
||||
|
||||
### Security
|
||||
|
||||
## [1.0.0] - 2020-06-29
|
29
README.md
29
README.md
|
@ -1,14 +1,25 @@
|
|||
# Prometheus ESP8266 DHT Exporter
|
||||
|
||||
[![GitHub release](https://img.shields.io/github/v/release/HON95/prometheus-esp8266-dht-exporter?label=Version)](https://github.com/HON95/prometheus-esp8266-dht-exporter/releases)
|
||||
|
||||
A Prometheus exporter for IoT temperature and humidity measurements, using an ESP8266 (Arduino-compatible) with a Wi-Fi module and a DHT (temperature + humidity) sensor.
|
||||
|
||||
## Metrics
|
||||
|
||||
| Metric | Description | Unit |
|
||||
| - | - | - |
|
||||
| iot_info | Metadata about the device. | |
|
||||
| iot_air_humidity_percent | Air humidity. | `%` |
|
||||
| iot_air_temperature_celsius | Air temperature. | `°C` |
|
||||
| iot_air_heat_index_celsius | Apparent air temperature, based on temperature and humidity. | `°C` |
|
||||
|
||||
## Hardware
|
||||
|
||||
ESP8266 board: [WEMOS D1 Mini](https://wiki.wemos.cc/products:d1:d1_mini) (ESP8266)
|
||||
ESP8266-based board: [WEMOS D1 Mini](https://wiki.wemos.cc/products:d1:d1_mini)
|
||||
|
||||
DHT sensor: [Wemos DHT Shield](https://wiki.wemos.cc/products:retired:dht_shield_v1.0.0) (DHT11)
|
||||
|
||||
## Requirements
|
||||
## Software
|
||||
|
||||
- [Arduino IDE](https://www.arduino.cc/en/Main/Software)
|
||||
- Download and install.
|
||||
|
@ -27,10 +38,12 @@ This uses the Arduino IDE.
|
|||
- WEMOS D1 Mini uses board "WeMoS D1 R2 & mini".
|
||||
1. Build and upload using the Arduino IDE.
|
||||
|
||||
## Metrics
|
||||
## Version
|
||||
|
||||
| Metric | Description | Unit |
|
||||
| - | - | - |
|
||||
| iot_air_humidity_percent | Air humidity. | `%` |
|
||||
| iot_air_temperature_celsius | Air temperature. | `°C` |
|
||||
| iot_air_heat_index_celsius | Apparent air temperature, based on temperature and humidity. | `°C` |
|
||||
See `src/version.h`.
|
||||
|
||||
It's set manually since no build tools (or CI) other than the Arduino IDE is used.
|
||||
|
||||
## License
|
||||
|
||||
GNU General Public License version 3 (GPLv3).
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
// Debug mode is enabled if not zero
|
||||
#define DEBUG_MODE 0
|
||||
// Board name
|
||||
#define BOARD_NAME "ESP8266"
|
||||
// DHT sensor name (should be the same)
|
||||
#define DHT_NAME "DHT11"
|
||||
// DHT sensor type
|
||||
#define DHT_TYPE DHT11
|
||||
// DHT pin
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <DHTesp.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "version.h"
|
||||
|
||||
enum LogLevel {
|
||||
DEBUG,
|
||||
|
@ -88,6 +89,10 @@ void handle_http_home_client() {
|
|||
void handle_http_metrics_client() {
|
||||
static size_t const BUFSIZE = 1024;
|
||||
static char const *response_template =
|
||||
"# HELP iot_info Metadata about the device.\n"
|
||||
"# TYPE iot_info gauge\n"
|
||||
"# UNIT iot_info \n"
|
||||
"iot_info{version=\"%s\",board=\"%s\",sensor=\"%s\"} 1\n"
|
||||
"# HELP iot_air_humidity_percent Air humidity.\n"
|
||||
"# TYPE iot_air_humidity_percent gauge\n"
|
||||
"# UNIT iot_air_humidity_percent %%\n"
|
||||
|
@ -108,7 +113,7 @@ void handle_http_metrics_client() {
|
|||
}
|
||||
|
||||
char response[BUFSIZE];
|
||||
snprintf(response, BUFSIZE, response_template, humidity, temperature, heat_index);
|
||||
snprintf(response, BUFSIZE, response_template, VERSION, BOARD_NAME, DHT_NAME, humidity, temperature, heat_index);
|
||||
http_server.send(200, "text/plain; charset=utf-8", response);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
#define VERSION "1.0.0"
|
Loading…
Reference in New Issue