From 41863e73a78a60bd292e8e044189fcd0cc84d7ae Mon Sep 17 00:00:00 2001 From: Luke Markie Date: Mon, 5 Feb 2024 09:36:20 +0000 Subject: [PATCH] RabbitMQ instance label for Linux --- linux/observability-agent-autoconf.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/linux/observability-agent-autoconf.sh b/linux/observability-agent-autoconf.sh index e1a39bb..c8cc774 100755 --- a/linux/observability-agent-autoconf.sh +++ b/linux/observability-agent-autoconf.sh @@ -670,11 +670,12 @@ if { (ss -ltn | grep -qE :5672) || [ -n "${rabbitmq_scrape_target}" ]; } && [ "$ if ! (ss -ltn | grep -qE :15692); then echo "RabbitMQ exporter is not enabled, see the Observability Agent docs to learn how to enable it" fi + instance_label=${rabbitmq_instance_label:=${rabbitmq_scrape_target:="127.0.0.1:15692"}} if [ -n "${rabbitmq_scrape_target}" ]; then cat <> "$CONFIG" prometheus.scrape "rabbit" { targets = [ - {"__address__" = "$rabbitmq_scrape_target", "instance" = "one"}, + {"__address__" = "$rabbitmq_scrape_target", "instance" = "${instance_label}"}, ] forward_to = [prometheus.remote_write.default.receiver] @@ -685,7 +686,7 @@ EOF cat <> "$CONFIG" prometheus.scrape "rabbit" { targets = [ - {"__address__" = "127.0.0.1:15692", "instance" = "one"}, + {"__address__" = "127.0.0.1:15692", "instance" = "${instance_label}"}, ] forward_to = [prometheus.remote_write.default.receiver]