Compare commits
No commits in common. "f7fa2c751019c87296c35d8672a1e17d0d5fbb71" and "9d1452f16030242e2149583cd592614c72716f8a" have entirely different histories.
f7fa2c7510
...
9d1452f160
14 changed files with 1 additions and 190 deletions
9
.env
9
.env
|
|
@ -1,9 +0,0 @@
|
||||||
# InfluxDB
|
|
||||||
INFLUXDB_URL=http://influxdb:8086
|
|
||||||
INFLUXDB_ORG=Bischoffsheim
|
|
||||||
INFLUXDB_BUCKET=Temperaturen
|
|
||||||
INFLUXDB_TOKEN=1wml0Wzrno-VPHxw0N4CSJh42aTAE-zCCAnAj8BLY_YxsmexXO6_8o7i1HDdAPzDUndCCsejWKq9GJXeYFDhpQ==
|
|
||||||
|
|
||||||
# MQTT
|
|
||||||
MQTT_USER=dein_user
|
|
||||||
MQTT_PASS=dein_passwort
|
|
||||||
18
README.md
18
README.md
|
|
@ -23,20 +23,4 @@ Stack
|
||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
<img src="pic/grafan.png" alt="mqtt" width="500"/>
|
<img src="pic/grafan.png" alt="mqtt" width="500"/>
|
||||||
|
|
||||||
>git clone https://git.hintergasse.de/hubobel/MTIG-Stack.git
|
|
||||||
|
|
||||||
>cd MTIG-Stack
|
|
||||||
|
|
||||||
>mkdir -p \
|
|
||||||
> influxdb/{data,config} \
|
|
||||||
> grafana/{data,config} \
|
|
||||||
> mosquitto/{config,data,log} \
|
|
||||||
> telegraf
|
|
||||||
|
|
||||||
>chown -R 472:472 grafana
|
|
||||||
|
|
||||||
>docker compose up -d --force-recreate
|
|
||||||
|
|
||||||
>docker ps
|
|
||||||
|
|
@ -1,77 +0,0 @@
|
||||||
version: "3.9"
|
|
||||||
|
|
||||||
services:
|
|
||||||
influxdb:
|
|
||||||
image: influxdb:latest
|
|
||||||
container_name: influxdb
|
|
||||||
restart: unless-stopped
|
|
||||||
ports:
|
|
||||||
- "8086:8086"
|
|
||||||
volumes:
|
|
||||||
- ./influxdb/data:/var/lib/influxdb2
|
|
||||||
- ./influxdb/config:/etc/influxdb2
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "curl", "-fsS", "http://localhost:8086/health"]
|
|
||||||
interval: 5s
|
|
||||||
timeout: 3s
|
|
||||||
retries: 20
|
|
||||||
|
|
||||||
grafana:
|
|
||||||
image: grafana/grafana:latest
|
|
||||||
container_name: grafana
|
|
||||||
restart: unless-stopped
|
|
||||||
user: "0"
|
|
||||||
ports:
|
|
||||||
- "3000:3000"
|
|
||||||
volumes:
|
|
||||||
- ./grafana/data:/var/lib/grafana
|
|
||||||
- ./grafana/config:/etc/grafana
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:3000/api/health"]
|
|
||||||
interval: 5s
|
|
||||||
timeout: 3s
|
|
||||||
retries: 20
|
|
||||||
depends_on:
|
|
||||||
influxdb:
|
|
||||||
condition: service_healthy
|
|
||||||
|
|
||||||
mqtt5:
|
|
||||||
image: eclipse-mosquitto:latest
|
|
||||||
container_name: mqtt5
|
|
||||||
restart: unless-stopped
|
|
||||||
ports:
|
|
||||||
- "1883:1883"
|
|
||||||
- "9001:9001"
|
|
||||||
volumes:
|
|
||||||
- ./mosquitto/config:/mosquitto/config
|
|
||||||
- ./mosquitto/data:/mosquitto/data
|
|
||||||
- ./mosquitto/log:/mosquitto/log
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "mosquitto_pub -h localhost -p 1883 -t healthcheck/ping -n >/dev/null 2>&1 || exit 1"]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 12
|
|
||||||
|
|
||||||
telegraf:
|
|
||||||
image: telegraf:latest
|
|
||||||
container_name: telegraf
|
|
||||||
restart: unless-stopped
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
volumes:
|
|
||||||
- ./telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro
|
|
||||||
depends_on:
|
|
||||||
mqtt5:
|
|
||||||
condition: service_healthy
|
|
||||||
influxdb:
|
|
||||||
condition: service_healthy
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "pidof telegraf >/dev/null 2>&1 || exit 1"]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 3s
|
|
||||||
retries: 12
|
|
||||||
|
|
||||||
networks:
|
|
||||||
default:
|
|
||||||
name: mqtt5-network
|
|
||||||
external: true
|
|
||||||
|
|
@ -1,87 +0,0 @@
|
||||||
# -------------------------------------------------------------------
|
|
||||||
# Telegraf Agent
|
|
||||||
# -------------------------------------------------------------------
|
|
||||||
[agent]
|
|
||||||
interval = "10s"
|
|
||||||
round_interval = true
|
|
||||||
|
|
||||||
metric_batch_size = 1000
|
|
||||||
metric_buffer_limit = 10000
|
|
||||||
|
|
||||||
collection_jitter = "0s"
|
|
||||||
flush_interval = "10s"
|
|
||||||
flush_jitter = "0s"
|
|
||||||
|
|
||||||
precision = ""
|
|
||||||
hostname = ""
|
|
||||||
omit_hostname = false
|
|
||||||
|
|
||||||
|
|
||||||
# -------------------------------------------------------------------
|
|
||||||
# OUTPUT: InfluxDB v2
|
|
||||||
# -------------------------------------------------------------------
|
|
||||||
[[outputs.influxdb_v2]]
|
|
||||||
urls = ["${INFLUXDB_URL}"]
|
|
||||||
token = "${INFLUXDB_TOKEN}"
|
|
||||||
organization = "${INFLUXDB_ORG}"
|
|
||||||
bucket = "${INFLUXDB_BUCKET}"
|
|
||||||
|
|
||||||
|
|
||||||
# -------------------------------------------------------------------
|
|
||||||
# INPUT 1: MQTT JSON (Temperaturen)
|
|
||||||
# Topics: daten/status/+
|
|
||||||
# -------------------------------------------------------------------
|
|
||||||
[[inputs.mqtt_consumer]]
|
|
||||||
servers = ["tcp://mqtt5:1883"]
|
|
||||||
topics = ["daten/status/+"]
|
|
||||||
|
|
||||||
qos = 1
|
|
||||||
persistent_session = true
|
|
||||||
client_id = "telegraf_mqtt_temperature"
|
|
||||||
|
|
||||||
username = "${MQTT_USER}"
|
|
||||||
password = "${MQTT_PASS}"
|
|
||||||
|
|
||||||
topic_tag = "topic"
|
|
||||||
data_format = "json_v2"
|
|
||||||
|
|
||||||
[[inputs.mqtt_consumer.json_v2]]
|
|
||||||
measurement_name = "temperature"
|
|
||||||
|
|
||||||
[[inputs.mqtt_consumer.json_v2.tag]]
|
|
||||||
path = "id"
|
|
||||||
rename = "sensor_id"
|
|
||||||
type = "int"
|
|
||||||
|
|
||||||
[[inputs.mqtt_consumer.json_v2.field]]
|
|
||||||
path = "tC"
|
|
||||||
rename = "tC"
|
|
||||||
type = "float"
|
|
||||||
|
|
||||||
[[inputs.mqtt_consumer.json_v2.field]]
|
|
||||||
path = "tF"
|
|
||||||
rename = "tF"
|
|
||||||
type = "float"
|
|
||||||
|
|
||||||
|
|
||||||
# -------------------------------------------------------------------
|
|
||||||
# INPUT 2: MQTT Plain Values (Power)
|
|
||||||
# Topics: daten/status/power/+
|
|
||||||
# Payload: z. B. 396.963
|
|
||||||
# -------------------------------------------------------------------
|
|
||||||
[[inputs.mqtt_consumer]]
|
|
||||||
servers = ["tcp://mqtt5:1883"]
|
|
||||||
topics = ["daten/status/power/+"]
|
|
||||||
|
|
||||||
qos = 1
|
|
||||||
persistent_session = true
|
|
||||||
client_id = "telegraf_mqtt_power"
|
|
||||||
|
|
||||||
username = "${MQTT_USER}"
|
|
||||||
password = "${MQTT_PASS}"
|
|
||||||
|
|
||||||
data_format = "value"
|
|
||||||
data_type = "float"
|
|
||||||
name_override = "power"
|
|
||||||
|
|
||||||
topic_tag = "topic"
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue