add documentation prometheus integration (#55)

This commit is contained in:
Henry Thasler
2024-06-02 20:41:06 +02:00
committed by GitHub
parent 8b4832af1a
commit ff3231f5d2
3 changed files with 49 additions and 0 deletions

View File

@@ -132,3 +132,7 @@ Note: For more detailed information to the REST handler, have a look to the code
### heap
print relevant memory (heap) information
- Example: `Heap info: Heap Total: 1888926 | SPI Free: 1827431 | SPI Larg Block: 1802240 | SPI Min Free: 758155 | Int Free: 61495 | Int Larg Block: 55296 | Int Min Free: 36427`
## Prometheus/OpenMetrics
### metrics
Provides a set of metrics that can be scraped by prometheus. See [Prometheus/OpenMetrics](../prometheus-openmetrics) for details.

View File

@@ -32,6 +32,7 @@ nav:
- Neural-Network-Types.md
- Additional-Information.md
- New-Releases-Notification.md
- prometheus-openmetrics.md
- Troubleshooting:
- Reduced webinterface (error codes): Error-Codes.md

View File

@@ -0,0 +1,44 @@
# Prometheus/OpenMetrics
A set of metrics is exported via the `/metrics` path on the device. Besides the current value, a set of device properties are exported. Multiple sequences (aka *numbers*) are supported via a label. The metrics are provided in text wire format.
Example:
```bash
$ curl http://192.168.178.23/metrics
# HELP ai_on_the_edge_device_flow_value current value of meter readout
# TYPE ai_on_the_edge_device_flow_value gauge
ai_on_the_edge_device_flow_value{sequence="main"} 240.7064
# HELP ai_on_the_edge_device_cpu_temperature_celsius current cpu temperature in celsius
# TYPE ai_on_the_edge_device_cpu_temperature_celsius gauge
ai_on_the_edge_device_cpu_temperature_celsius 41
# HELP ai_on_the_edge_device_rssi_dbm current WiFi signal strength in dBm
# TYPE ai_on_the_edge_device_rssi_dbm gauge
ai_on_the_edge_device_rssi_dbm -67
# HELP ai_on_the_edge_device_memory_heap_free_bytes available heap memory
# TYPE ai_on_the_edge_device_memory_heap_free_bytes gauge
ai_on_the_edge_device_memory_heap_free_bytes 716303
# HELP ai_on_the_edge_device_uptime_seconds device uptime in seconds
# TYPE ai_on_the_edge_device_uptime_seconds gauge
ai_on_the_edge_device_uptime_seconds 214267
# HELP ai_on_the_edge_device_rounds_total data aquisition rounds since device startup
# TYPE ai_on_the_edge_device_rounds_total counter
ai_on_the_edge_device_rounds_total 239
```
## Prometheus Scrape Config
The following scrape config (add to `prometheus.yml`) can be used as an example to ingest available metrics with prometheus:
```
scrape_configs:
- job_name: watermeter
scrape_interval: 300s
metrics_path: /metrics
static_configs:
- targets: ['192.168.178.23']
```
## References
- [OpenMetrics](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md)