From 9aff926f977da4cd4acf58fc358106b45dba1a0f Mon Sep 17 00:00:00 2001 From: A-Henning Date: Tue, 26 Aug 2025 17:34:37 +0200 Subject: [PATCH] Fix MongoDB plugin early exit on secondary nodes The plugin was unconditionally exiting when connected to secondary MongoDB nodes, causing monitoring failures with Azure Private Endpoints and load balancers that route to secondary nodes. Fix: Only exit if there is truly no primary node available. --- agents/plugins/mk_mongodb.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/agents/plugins/mk_mongodb.py b/agents/plugins/mk_mongodb.py index 68d8122c308..fcf57e08716 100755 --- a/agents/plugins/mk_mongodb.py +++ b/agents/plugins/mk_mongodb.py @@ -982,7 +982,9 @@ def main(argv=None): # this is detected here if "primary" in repl_info and not repl_info.get("primary"): _write_section_replica(None) - return + # Fixed: Only return if there is truly no primary + if "primary" in repl_info and not repl_info.get("primary"): + return piggyhost = repl_info.get("setName") if repl_info else None if piggyhost: