Skip to content

MongoDB exporter gets some metrics but Grafana dashboard does not display them #1020

@Kenya-West

Description

@Kenya-West

Describe the bug
Noobie here.
I successfully setup multi-target MongoDB exporter and got metrics by target URL in Prometheus but there is no data in Grafana dashboards. Used this and this one.

To Reproduce
Steps to reproduce the behavior:

  1. Setup docker-compose.yml:
---
services:
  mongodb_exporter:
    image: percona/mongodb_exporter:0.43.1
    container_name: mongodb_exporter
    cpus: 0.5
    mem_limit: 200m
    env_file:
      - .env
    networks:
      - caddy

networks:
  caddy:
    external: true
  1. In .env, set hosts to collect data from as following:
MONGODB_URI=mongodb+srv://user:password@cluster6.9texege.mongodb.net/admin
  1. Add Prometheus config record:
  - job_name: MongoDB
    file_sd_configs:
    - files:
      - /etc/file_sd/mongodb_targets_custom.yml
      refresh_interval: 30s
  1. Setup mongodb_targets_custom.yml:
- targets:
  - mongodb_exporter:9216
  labels:
    __metrics_path__: /scrape
    __param_target: cluster6.9texege.mongodb.net
  1. See green 🟩 UP status in Prometheus and check metrics manually by HTTP:
/ # wget -O- http://mongodb_exporter:9216/scrape?target=cluster6.9texege.mongodb.net | tail -n 12
Connecting to mongodb_exporter:9216 (172.18.0.13:9216)
writing to stdout
-                    100% |**************************************************|  8471  0:00:00 ETA
written to stdout
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 2.8643328e+07
# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1.73835338716e+09
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 1.279807488e+09
# 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
  1. Add this or this one of dashboards in Grafana

Expected behavior
I should see some bars, charts and data regardless of selected filters.

Actual behavior
All data is void.

Environment

  • MongoDB exporter 0.43.1
  • Ubuntu 24.04
  • Docker the latest
  • MongoDB version 8.0.4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions