如何使用 MongoDB Exporter 监控服务
更新时间:2025-08-15 03:41:38
功能概述
为了实现多维监控数据库,MongoDB 支持启用 MongoDB Exporter 监控服务,对接 Prometheus 和 Grafana 提供节点服务状态监控。详细监控指标项,请参见 官方文档。
操作步骤
步骤一:安装 Prometheus 和 Grafana
客户端服务器上安装 Prometheus 和 Grafana。要求与 MongoDB 集群之间保持网络通畅。
步骤二:启动 Mongodb Exporter 服务
修改配置参数 Mongodb Exporter: 是否开启 值为 是,详情可参考修改集群配置参数。
步骤三:配置 Mongodb Exporter 监控
-
参考 Redis Enterprise Software Integration with Prometheus,在客户端的 Prometheus 服务中添加 Mongodb 节点为数据源。成功添加数据源后,即可在 Grafana 查看节点资源监控信息。
-
查看 MongoDB 节点信息,可参考获取 MongoDB 连接地址。
-
访问
http://<Node IP>:<MongoDB Exporter Port>/metrics,可验证 MongoDB Exporter 监控是否配置成功。其中<Node IP>为上一步查询的节点 IP 地址,<MongoDB Exporter Port>默认为9001。
步骤四:关闭 MongoDB Exporter 服务
若无需 MongoDB Exporter 服务时,可在 AppCenter 关闭该服务。
修改配置参数 Mongodb Exporter: 是否开启 值为 否,详情可参考修改集群配置参数。