telegraf added
This commit is contained in:
parent
68f6bd7817
commit
9e875c455d
3 changed files with 82 additions and 0 deletions
2
telegraf/.env
Normal file
2
telegraf/.env
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
MQTT_USERNAME=mqtt_user
|
||||
MQTT_PASSWORD=mqtt_pw
|
||||
13
telegraf/docker-compose.yml
Normal file
13
telegraf/docker-compose.yml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
services:
|
||||
telegraf:
|
||||
image: docker.io/telegraf:latest
|
||||
container_name: telegraf
|
||||
environment:
|
||||
- MQTT_USERNAME=${MQTT_USERNAME}
|
||||
- MQTT_PASSWORD=${MQTT_PASSWORD}
|
||||
volumes:
|
||||
- ./telegraf.conf:/etc/telegraf/telegraf.conf:ro
|
||||
networks:
|
||||
default:
|
||||
name: mqtt5-network
|
||||
external: true
|
||||
67
telegraf/telegraf.conf
Normal file
67
telegraf/telegraf.conf
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
# Configuration for 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 = ""
|
||||
|
||||
|
||||
## Override default hostname, if empty use os.Hostname()
|
||||
hostname = ""
|
||||
## If set to true, do no set the "host" tag in the telegraf agent.
|
||||
omit_hostname = false
|
||||
[[outputs.influxdb_v2]]
|
||||
## The URLs of the InfluxDB cluster nodes.
|
||||
|
||||
urls = ["http://influx-influxdb-1:8086"]
|
||||
|
||||
## Token for authentication.
|
||||
token = "SPIryLp_2qM35A-GDTE3gEoCtZqAPaiDxPwWgIUy6JQ4uU4ctBbMZDsSD3D7kf5FokBQE4F2mmyx9pvOU7ryTg=="
|
||||
|
||||
## Organization is the name of the organization you wish to write to; must exist.
|
||||
organization = "Bischoffsheim"
|
||||
|
||||
## Destination bucket to write into.
|
||||
bucket = "Bischoffsheim"
|
||||
|
||||
[[inputs.mqtt_consumer]]
|
||||
servers = ["tcp://mqtt5:1883"]
|
||||
topics = ["daten/status/+"] # deckt "daten/status/temperature:100" ab
|
||||
qos = 1
|
||||
persistent_session = true
|
||||
client_id = "telegraf_mqtt_influx3"
|
||||
username = "${MQTT_USERNAME}"
|
||||
password = "${MQTT_PASSWORD}"
|
||||
topic_tag = "topic"
|
||||
|
||||
data_format = "json_v2"
|
||||
|
||||
[[inputs.mqtt_consumer.json_v2]]
|
||||
measurement_name = "temperature"
|
||||
|
||||
# id als Tag (saubere Gruppierung / Filter in Influx)
|
||||
[[inputs.mqtt_consumer.json_v2.tag]]
|
||||
path = "id"
|
||||
rename = "sensor_id"
|
||||
type = "int"
|
||||
|
||||
# Felder
|
||||
[[inputs.mqtt_consumer.json_v2.field]]
|
||||
path = "tC"
|
||||
rename = "tC"
|
||||
type = "float"
|
||||
|
||||
[[inputs.mqtt_consumer.json_v2.field]]
|
||||
path = "tF"
|
||||
rename = "tF"
|
||||
type = "float"
|
||||
Loading…
Add table
Add a link
Reference in a new issue