From ff3231f5d20eb892df4ff1ecf43695a940a3ca79 Mon Sep 17 00:00:00 2001 From: Henry Thasler Date: Sun, 2 Jun 2024 20:41:06 +0200 Subject: [PATCH] add documentation prometheus integration (#55) --- docs/REST-API.md | 4 ++++ docs/nav.yml | 1 + docs/prometheus-openmetrics.md | 44 ++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 docs/prometheus-openmetrics.md diff --git a/docs/REST-API.md b/docs/REST-API.md index 7ceab2e..420a25c 100644 --- a/docs/REST-API.md +++ b/docs/REST-API.md @@ -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. \ No newline at end of file diff --git a/docs/nav.yml b/docs/nav.yml index 2a81938..65cd76a 100644 --- a/docs/nav.yml +++ b/docs/nav.yml @@ -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 diff --git a/docs/prometheus-openmetrics.md b/docs/prometheus-openmetrics.md new file mode 100644 index 0000000..74cdefa --- /dev/null +++ b/docs/prometheus-openmetrics.md @@ -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) \ No newline at end of file