From 5dfd0508da6cee8ca5997671a351a2aee88b4269 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Mon, 29 Apr 2024 15:19:37 +0800 Subject: [PATCH] Update index.py --- plugins/mongodb/index.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/mongodb/index.py b/plugins/mongodb/index.py index 14d7b4568..3a2ecd778 100755 --- a/plugins/mongodb/index.py +++ b/plugins/mongodb/index.py @@ -232,10 +232,12 @@ def runReplInfo(): if 'repl' in serverStatus: repl = serverStatus['repl'] # print(repl) + result['status'] = '从' if 'ismaster' in repl and repl['ismaster']: result['status'] = '主' - else: - result['status'] = '从' + + if 'secondary' in repl and repl['secondary']: + result['status'] = '主' result['setName'] = repl['setName'] result['primary'] = repl['primary']