From 613df62e3276fc003ed48e456306b55a41f16087 Mon Sep 17 00:00:00 2001 From: hubobel Date: Sun, 11 Jan 2026 16:58:25 +0100 Subject: [PATCH] Health Checks eingebaut --- grafana/docker-compos.yml | 5 +++++ influx/docker-compose.yml | 6 ++++++ mqtt/docker-compose.yml | 5 +++++ telegraf/docker-compose.yml | 5 +++++ telegraf/telegraf.conf | 14 +++++++++++++- 5 files changed, 34 insertions(+), 1 deletion(-) diff --git a/grafana/docker-compos.yml b/grafana/docker-compos.yml index 0ab477c..bb4a459 100644 --- a/grafana/docker-compos.yml +++ b/grafana/docker-compos.yml @@ -3,6 +3,11 @@ services: image: grafana/grafana container_name: grafana restart: unless-stopped + healthcheck: + test: [ "CMD", "curl", "-f", "http://localhost:3000/api/health" ] + interval: 5s + timeout: 3s + retries: 20 user: '0' ports: - '3000:3000' diff --git a/influx/docker-compose.yml b/influx/docker-compose.yml index 883ea51..85fb5f8 100644 --- a/influx/docker-compose.yml +++ b/influx/docker-compose.yml @@ -2,6 +2,12 @@ services: influxdb: image: influxdb:latest restart: unless-stopped + healthcheck: + test: [ "CMD", "curl", "-f", "http://localhost:8086/health" ] + interval: 5s + timeout: 3s + retries: 20 + ports: - '8086:8086' volumes: diff --git a/mqtt/docker-compose.yml b/mqtt/docker-compose.yml index d33d648..09cff99 100644 --- a/mqtt/docker-compose.yml +++ b/mqtt/docker-compose.yml @@ -3,6 +3,11 @@ services: mqtt5: image: eclipse-mosquitto container_name: mqtt5 + healthcheck: + test: [ "CMD-SHELL", "mosquitto_sub -h localhost -p 1883 -t '$SYS/#' -C 1 -W 2 >/dev/null 2>&1 || exit 1" ] + interval: 10s + timeout: 5s + retries: 12 ports: - "1883:1883" #default mqtt port - "9001:9001" #default mqtt port for websockets diff --git a/telegraf/docker-compose.yml b/telegraf/docker-compose.yml index 7c07ac6..ae11c4f 100644 --- a/telegraf/docker-compose.yml +++ b/telegraf/docker-compose.yml @@ -3,6 +3,11 @@ services: image: docker.io/telegraf:latest container_name: telegraf restart: unless-stopped + healthcheck: + test: [ "CMD", "curl", "-f", "http://localhost:8094" ] + interval: 10s + timeout: 3s + retries: 12 environment: - MQTT_USERNAME=${MQTT_USERNAME} - MQTT_PASSWORD=${MQTT_PASSWORD} diff --git a/telegraf/telegraf.conf b/telegraf/telegraf.conf index 566f02c..bc7c3aa 100644 --- a/telegraf/telegraf.conf +++ b/telegraf/telegraf.conf @@ -64,4 +64,16 @@ [[inputs.mqtt_consumer.json_v2.field]] path = "tF" rename = "tF" - type = "float" \ No newline at end of file + type = "float" +[[inputs.mqtt_consumer]] + servers = ["tcp://mqtt5:1883"] + topics = ["daten/status/power/+"] + username = "${MQTT_USERNAME}" + password = "${MQTT_PASSWORD}" + + + data_format = "value" + data_type = "float" + name_override = "power" + + topic_tag = "topic" \ No newline at end of file