From 5da5ed0f1c57634572f3ddc0d44e52036840b581 Mon Sep 17 00:00:00 2001 From: Dragomir Penev Date: Wed, 25 Oct 2023 17:47:18 +0300 Subject: [PATCH] Scrape IP instead of localhost --- src/charm.py | 2 +- templates/patroni.yml.j2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/charm.py b/src/charm.py index 81a7ed10a1..ca35c9dd24 100755 --- a/src/charm.py +++ b/src/charm.py @@ -157,7 +157,7 @@ def patroni_scrape_config(self) -> List[Dict]: return [ { "metrics_path": "/metrics", - "static_configs": [{"targets": ["localhost:8008"]}], + "static_configs": [{"targets": [f"{self._unit_ip}:8008"]}], "tls_config": {"insecure_skip_verify": True}, "scheme": "https" if self.is_tls_enabled else "http", } diff --git a/templates/patroni.yml.j2 b/templates/patroni.yml.j2 index 96f27b1d37..3b31336634 100644 --- a/templates/patroni.yml.j2 +++ b/templates/patroni.yml.j2 @@ -19,7 +19,7 @@ log: file_size: 600 restapi: - listen: '0.0.0.0:8008' + listen: '{{ self_ip }}:8008' connect_address: '{{ self_ip }}:8008' {%- if enable_tls %} cafile: {{ conf_path }}/ca.pem