背景:由于官方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: