背景:由于官方mogno_exporter更新至最新版本后–help并没用显示支持ip1:port1,ip2:port2这种形式,直接参参数启动的时候会有报错(直连无法操作多个ip)
level=error msg=“Cannot connect to MongoDB: invalid MongoDB options: a direct connection cannot be made if multiple hosts are specified”
百度了很久,找到的示例都是单节点的,或者是老版本基于二进制启动(楼主尝试之后,老版本二进制启动也无法直接使用多ip)
经过对–help中参数摸索,可以使用–no-mongodb.direct-connect解决
由于我使用的是docker-compose启动yaml,示例入下:
#mongo-exporter
mogno-exporter:
image: percona/mongodb_exporter:0.35.0
environment:
- TZ=Asia/Shanghai
- MONGODB_URI=mon

本文介绍了在mogno_exporter最新版本中,如何通过配置参数`--no-mongodb.direct-connect`来监控整个MongoDB集群,解决了直接连接多主机报错的问题。在监控中,当节点关闭时,对应的健康检查指标会准确反映状态变化。
最低0.47元/天 解锁文章

1258





