Mongodb_exporter开启--collect-all仅导出mongodb_up指标求助
MongoDB Exporter(Sidecar模式)仅导出基础指标问题排查请求
问题描述
在K8S环境中以Sidecar Pod方式运行mongodb_exporter(MongoDB的Prometheus指标导出器),遇到以下异常:
- 导出器启动无报错,但仅能获取Go相关指标和
mongodb_up 1这一个MongoDB指标 - 即使开启
--collect-all或--collector.collstats参数,也无法获取config库的集合大小等有效业务指标 - 数据库连接正常(修改账号密码/端口会触发明确的连接错误)
- 已为exporter用户配置admin库的
clusterMonitor权限和local库的read权限
Pod配置
- name: metrics image: docker.io/bitnami/mongodb-exporter:latest command: - /bin/bash - '-ec' args: - > /bin/mongodb_exporter --web.listen-address ":9216" --mongodb.uri=mongodb://exporter:password@localhost:27017/config? --log.level="debug" --collect-all ports: - name: metrics containerPort: 9216 protocol: TCP env: resources: limits: cpu: 50m memory: 250Mi requests: cpu: 25m memory: 50Mi livenessProbe: httpGet: path: / port: metrics scheme: HTTP initialDelaySeconds: 15 timeoutSeconds: 5 periodSeconds: 5 successThreshold: 1 failureThreshold: 3 readinessProbe: httpGet: path: / port: metrics scheme: HTTP initialDelaySeconds: 5 timeoutSeconds: 1 periodSeconds: 5 successThreshold: 1 failureThreshold: 3
日志信息
导出器启动日志(开启debug)
time="2023-02-03T09:02:25Z" level=debug msg="Compatible mode: false" time="2023-02-03T09:02:25Z" level=debug msg="Connection URI: mongodb://exporter:password@localhost:27017/config?" level=info ts=2023-02-03T09:02:25.224Z caller=tls_config.go:195 msg="TLS is disabled." http2=false
已展示的指标
# HELP collector_scrape_time_ms Time taken for scrape by collector # TYPE collector_scrape_time_ms gauge collector_scrape_time_ms{collector="general",exporter="mongodb"} 0 # HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles. # TYPE go_gc_duration_seconds summary go_gc_duration_seconds{quantile="0"} 0 go_gc_duration_seconds{quantile="0.25"} 0 go_gc_duration_seconds{quantile="0.5"} 0 go_gc_duration_seconds{quantile="0.75"} 0 go_gc_duration_seconds{quantile="1"} 0 go_gc_duration_seconds_sum 0 go_gc_duration_seconds_count 0 # HELP go_goroutines Number of goroutines that currently exist. # TYPE go_goroutines gauge go_goroutines 17 # HELP go_info Information about the Go environment. # TYPE go_info gauge go_info{version="go1.17.13"} 1 # HELP go_memstats_alloc_bytes Number of bytes allocated and still in use. # TYPE go_memstats_alloc_bytes gauge go_memstats_alloc_bytes 3.655088e+06 # HELP go_memstats_alloc_bytes_total Total number of bytes allocated, even if freed. # TYPE go_memstats_alloc_bytes_total counter go_memstats_alloc_bytes_total 3.655088e+06 [....] # HELP mongodb_up Whether MongoDB is up. # TYPE mongodb_up gauge mongodb_up 1 [...] # HELP process_virtual_memory_bytes Virtual memory size in bytes. # TYPE process_virtual_memory_bytes gauge process_virtual_memory_bytes 7.35940608e+08 # HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes. # TYPE process_virtual_memory_max_bytes gauge process_virtual_memory_max_bytes 1.8446744073709552e+19
环境信息
- K8S环境
- MongoDB版本:4.2.0
恳请各位提供排查思路或解决方案!
内容的提问来源于stack exchange,提问作者Doul
相关产品推荐
相关产品推荐

