From cce4c3776e1ad996c405757534dcc00ca7e23d61 Mon Sep 17 00:00:00 2001 From: Erich Blume Date: Fri, 16 Jan 2026 12:02:52 -0800 Subject: [PATCH] Fix PostgreSQL metrics by URL-encoding password in alloy config The password contained special characters (@, !, *) that broke the connection string URL parsing. Added urlencode filter to the template. Co-Authored-By: Claude Opus 4.5 --- ansible/roles/alloy/templates/config.alloy.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/roles/alloy/templates/config.alloy.j2 b/ansible/roles/alloy/templates/config.alloy.j2 index 5b73991..08e3cdf 100644 --- a/ansible/roles/alloy/templates/config.alloy.j2 +++ b/ansible/roles/alloy/templates/config.alloy.j2 @@ -40,7 +40,7 @@ prometheus.remote_write "prometheus" { // PostgreSQL exporter (read-only metrics via pg_monitor role) prometheus.exporter.postgres "postgresql" { - data_source_names = ["postgresql://{{ alloy_postgres_user }}:{{ alloy_postgres_password }}@{{ alloy_postgres_host }}:{{ alloy_postgres_port }}/{{ alloy_postgres_database }}?sslmode=disable"] + data_source_names = ["postgresql://{{ alloy_postgres_user }}:{{ alloy_postgres_password | urlencode }}@{{ alloy_postgres_host }}:{{ alloy_postgres_port }}/{{ alloy_postgres_database }}?sslmode=disable"] } // Scrape PostgreSQL metrics