From 0ab35571b92ecc21e4698031b6ad0f5d3144a389 Mon Sep 17 00:00:00 2001 From: polyfloyd Date: Mon, 15 Jul 2024 00:32:50 +0200 Subject: [PATCH] monitoring: Add MQTT exporter config for the Bambu printer --- roles/monitoring/tasks/mqtt_exporter.yaml | 1 + .../templates/mqtt_exporter_config.yaml | 26 +++++++++++++++++++ .../templates/public-bridge.conf | 1 + 3 files changed, 28 insertions(+) diff --git a/roles/monitoring/tasks/mqtt_exporter.yaml b/roles/monitoring/tasks/mqtt_exporter.yaml index 4fda9d9..b41fc42 100644 --- a/roles/monitoring/tasks/mqtt_exporter.yaml +++ b/roles/monitoring/tasks/mqtt_exporter.yaml @@ -10,6 +10,7 @@ - name: Install apt dependencies ansible.builtin.apt: name: + - jq - python3-paho-mqtt - python3-prometheus-client - python3-yaml diff --git a/roles/monitoring/templates/mqtt_exporter_config.yaml b/roles/monitoring/templates/mqtt_exporter_config.yaml index 62a9690..39d147a 100644 --- a/roles/monitoring/templates/mqtt_exporter_config.yaml +++ b/roles/monitoring/templates/mqtt_exporter_config.yaml @@ -56,3 +56,29 @@ export: - subscribe: bitlair/power/shelly/+num/status/switch:0 metric_name: bitlair_power_shelly value_json: .apower + + - subscribe: bambulab/device/+serial/report + metric_name: bambulab_nozzle_temperature + value_json: .print.nozzle_temper + - subscribe: bambulab/device/+serial/report + metric_name: bambulab_nozzle_target_temperature + value_json: .print.nozzle_target_temper + - subscribe: bambulab/device/+serial/report + metric_name: bambulab_bed_temperature + value_json: .print.bed_temper + - subscribe: bambulab/device/+serial/report + metric_name: bambulab_bed_target_temperature + value_json: .print.bed_target_temper + - subscribe: bambulab/device/+serial/report + metric_name: bambulab_chamber_temperature + value_json: .print.chamber_temper + - subscribe: bambulab/device/+serial/report + metric_name: bambulab_ams_humidity + value_json: .print.ams.ams[0].humidity + - subscribe: bambulab/device/+serial/report + metric_name: bambulab_print_progress + value_json: .print.mc_percent + - subscribe: bambulab/device/+serial/report + metric_name: bambulab_print_status + metric_type: info + value_json: .print.gcode_state diff --git a/roles/mqtt-internal/templates/public-bridge.conf b/roles/mqtt-internal/templates/public-bridge.conf index b1725cb..6040c03 100644 --- a/roles/mqtt-internal/templates/public-bridge.conf +++ b/roles/mqtt-internal/templates/public-bridge.conf @@ -3,6 +3,7 @@ connection public-bridge address {{ mqtt_public_host }} +topic bambulab/# out topic bitlair/alarm out topic bitlair/climate/# out topic bitlair/collectd/bitlair-5406/snmp/# out