From 222ceac7121d28f4336ff23628d453723ff8e4f9 Mon Sep 17 00:00:00 2001 From: kev Date: Wed, 24 Jan 2024 15:57:59 +0800 Subject: [PATCH] update mosquitto --- mosquitto/README.md | 2 +- mosquitto/telegraf-mqtt.conf | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 mosquitto/telegraf-mqtt.conf diff --git a/mosquitto/README.md b/mosquitto/README.md index 1888904..c4aa49a 100644 --- a/mosquitto/README.md +++ b/mosquitto/README.md @@ -29,7 +29,7 @@ $ docker-compose exec mosquitto sh >>> cat pwfile username:$6$IuF7JUzS1k/QoF3y$YpiClom7/== >>> exit -$ docker-compose restart +$ docker-compose kill -s SIGHUP $ tails -f data/log/mosquitto.log 2022-12-08T06:59:00: mosquitto version 1.4.8 (build date 2016-05-16 14:17:19+0000) starting 2022-12-08T06:59:01: Config loaded from /etc/mosquitto/mosquitto.conf. diff --git a/mosquitto/telegraf-mqtt.conf b/mosquitto/telegraf-mqtt.conf new file mode 100644 index 0000000..0ec30b4 --- /dev/null +++ b/mosquitto/telegraf-mqtt.conf @@ -0,0 +1,25 @@ +# +# See: https://www.influxdata.com/integration/mqtt-telegraf-consumer/ +# + +[[inputs.mqtt_consumer]] + servers = ["ssl://mqtt.easypi.duckdns.org:8883"] + topics = [ + "zigbee2mqtt/+", + ] + data_format = "json" + username = "telegraf" + password = "telegraf" + +[[processors.enum]] + order = 2 + [[processors.enum.mapping]] + field = "contact" + [processors.enum.mapping.value_mappings] + false = 0 + true = 1 + [[processors.enum.mapping]] + field = "occupancy" + [processors.enum.mapping.value_mappings] + false = 0 + true = 1