Skip to content

Commit bfcb533

Browse files
committed
mgr/cephadm: use ip_hash to enforce the same prometheues upstream
Implemented ip_hash in Nginx to ensure consistent upstream selection for Prometheus in HA scenarios. This helps maintain query consistency in Grafana and reduces gaps caused by Prometheus instance failovers. Fixes: https://tracker.ceph.com/issues/70352? Signed-off-by: Redouane Kachach <[email protected]>
1 parent 5c9094d commit bfcb533

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/pybind/mgr/cephadm/templates/services/mgmt-gateway/nginx.conf.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ http {
5252

5353
{% if prometheus_endpoints %}
5454
upstream prometheus_servers {
55+
ip_hash;
5556
{% for ep in prometheus_endpoints %}
5657
server {{ ep }};
5758
{% endfor %}

src/pybind/mgr/cephadm/tests/test_services.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4004,6 +4004,7 @@ def get_services_endpoints(name):
40044004
}
40054005
40064006
upstream prometheus_servers {
4007+
ip_hash;
40074008
server 192.168.100.100:9095;
40084009
server 192.168.100.101:9095;
40094010
}
@@ -4256,6 +4257,7 @@ def get_services_endpoints(name):
42564257
}
42574258
42584259
upstream prometheus_servers {
4260+
ip_hash;
42594261
server 192.168.100.100:9095;
42604262
server 192.168.100.101:9095;
42614263
}

0 commit comments

Comments
 (0)