Skip to main content

Mongodbatlas Receiver

Status Available in: contrib Maintainers: @justinianvoss22, @dyl10s, @ishleenk17 Source: opentelemetry-collector-contrib

Supported Telemetry

Logs Metrics

Overview

Getting Started

The MongoDB Atlas receiver takes the following parameters. public_key and private_key are the only two required values to receive metrics and logs and are obtained via the “API Keys” tab of the MongoDB Atlas Project Access Manager. In the example below both values are being pulled from the environment. In order to collect logs, at least one project must be specified. By default, logs for all clusters within a project will be collected. Clusters can be limited using either the include_clusters or exclude_clusters setting. In order to collect project events, the requesting API key needs the appropriate permission which at minimum is the Project Read Only role. Project events are specific to a single project. In order to collect organization events, the requesting API key needs the appropriate permission which at minimum is the Organization Member role. Organization events are collected across all the projects hosted on Atlas within the organization. These events are not associated with a project. In order to collect access logs, the requesting API key needs the appropriate permission which requires either the Project Owner or Organization Owner role. Access logs are specific to each cluster. MongoDB Atlas Documentation recommends a polling interval of 5 minutes.
  • base_url (default https://cloud.mongodb.com/) set the base URL to connect to Atlas Cloud
  • public_key (required for metrics, logs, or alerts in poll mode)
  • private_key (required for metrics, logs, or alerts in poll mode)
  • granularity (default PT1M - See MongoDB Atlas Documentation)
  • collection_interval (default 3m) This receiver collects metrics on an interval. Valid time units are ns, us (or µs), ms, s, m, h.
  • storage (optional) The component ID of a storage extension which can be used when polling for alerts or events . The storage extension prevents duplication of data after a collector restart by remembering which data were previously collected.
  • projects (optional for metrics) a slice of projects this receiver collects metrics from instead of all projects in an organization
    • name Name of the project to discover metrics from
    • include_clusters (default empty, exclusive with exclude_clusters)
    • exclude_clusters (default empty, exclusive with include_clusters)
      • If both include_clusters and exclude_clusters are empty, then all clusters in the project will be included
  • retry_on_failure
    • enabled (default true)
    • initial_interval (default 5s)
    • max_interval (default 30s)
    • max_elapsed_time (default 5m)
  • alerts
    • enabled (default false)
    • mode (default listen. Options are poll or listen)
    • secret (required if using listen mode)
    • endpoint (required if using listen mode)
    • poll_interval (default 5m, only relevant using poll mode)
    • page_size (default 100)
      • When in poll mode, this is the number of alerts that will be processed per request to the MongoDB Atlas API.
    • max_pages (default 10)
      • When in poll mode, this will limit how many pages of alerts the receiver will request for each project.
    • projects (required if using poll mode)
      • name (required if using poll mode)
      • include_clusters (default empty, exclusive with exclude_clusters)
      • exclude_clusters (default empty, exclusive with include_clusters)
        • If both include_clusters and exclude_clusters are empty, then all clusters in the project will be included
    • tls (relevant only for listen mode)
      • key_file
      • cert_file
  • logs
    • enabled (default false)
    • projects (required if enabled)
      • name (required if enabled)
      • collect_host_logs (default true)
      • collect_audit_logs (default false)
      • access_logs
        • enabled (default true, if the access_logs parameter is defined)
        • auth_result
          • If specified, will limit the access logs queried to successful accesses (true) or failed accesses (false). If not specified, all will be collected
        • page_size (default 20000)
          • This is the number of access logs that will be processed per request to the MongoDB Atlas API. The maximum value is 20000.
        • max_pages (default 10)
          • This will limit how many pages of access logs the receiver will request from the MongoDB Atlas API for a project.
        • poll_interval (default 5m)
          • This will define how frequently the MongoDB Atlas API is queried for Access Logs for the given project.
      • include_clusters (default empty)
      • exclude_clusters (default empty)
  • events
    • projects
      • name Name of the Project to discover events from.
    • organizations
      • id ID of the Organization to discover events from.
    • poll_interval (default 1m)
      • How often the receiver will poll the Events API for new events.
    • page_size (default 100)
      • This is the number of events that will be processed per request to the MongoDB Atlas API.
    • max_pages (default 25)
      • This will limit how many pages of events the receiver will request from the MongoDB Atlas API for each project.
    • types (defaults to all types of events)
      • This is a list of event types that the receiver will request from the API. If specified, the receiver will collect only the indicated types of events.
Examples: Receive metrics:
receivers:
  mongodb_atlas:
    public_key: ${env:MONGODB_ATLAS_PUBLIC_KEY}
    private_key: ${env:MONGODB_ATLAS_PRIVATE_KEY}
Listen for alerts (default mode):
receivers:
  mongodb_atlas:
    alerts:
      enabled: true
      secret: "some_secret"
      endpoint: "0.0.0.0:7706"
Poll alerts from API:
receivers:
  mongodb_atlas:
    public_key: <redacted>
    private_key: <redacted>
    alerts:
      enabled: true
      mode: poll
      projects:
      - name: Project 0
        include_clusters: [Cluster0]
      poll_interval: 1m
    # use of a storage extension is recommended to reduce chance of duplicated alerts
    storage: file_storage
Receive logs:
receivers:
  mongodb_atlas:
    logs:
      enabled: true
      projects: 
        - name: "project 1"
          collect_audit_logs: true
          collect_host_logs: true
Receive events:
receivers:
  mongodb_atlas:
    events:
      projects:
        - name: "project 1"
      organizations:
        - id: "5b478b3afc4625789ce616a3"
      poll_interval: 1m
      page_size: 100
      max_pages: 25
    # use of a storage extension is recommended to reduce chance of duplicated events
    storage: file_storage
Poll Access Logs from API:
receivers:
  mongodb_atlas:
    public_key: <redacted>
    private_key: <redacted>
    logs:
      enabled: true
      projects:
      - name: Project 0
        include_clusters: [Cluster0]
        access_logs:
          page_size: 20000
          max_pages: 10
          poll_interval: 5m
    # use of a storage extension is recommended to reduce chance of duplicated access logs
    storage: file_storage

Metrics

Metric NameDescriptionUnitTypeAttributes
mongodbatlas.db.countsDatabase feature size{objects}Gaugeobject_type
mongodbatlas.db.sizeDatabase feature sizeByGaugeobject_type
mongodbatlas.disk.partition.iops.averageDisk partition iops{ops}/sGaugedisk_direction
mongodbatlas.disk.partition.iops.maxDisk partition iops{ops}/sGaugedisk_direction
mongodbatlas.disk.partition.latency.averageDisk partition latencymsGaugedisk_direction
mongodbatlas.disk.partition.latency.maxDisk partition latencymsGaugedisk_direction
mongodbatlas.disk.partition.queue.depthDisk queue depth1Gauge
mongodbatlas.disk.partition.space.averageDisk partition spaceByGaugedisk_status
mongodbatlas.disk.partition.space.maxDisk partition spaceByGaugedisk_status
mongodbatlas.disk.partition.throughputDisk throughputBy/sGaugedisk_direction
mongodbatlas.disk.partition.usage.averageDisk partition usage (%)1Gaugedisk_status
mongodbatlas.disk.partition.usage.maxDisk partition usage (%)1Gaugedisk_status
mongodbatlas.disk.partition.utilization.averageThe percentage of time during which requests are being issued to and serviced by the partition.1Gauge
mongodbatlas.disk.partition.utilization.maxThe maximum percentage of time during which requests are being issued to and serviced by the partition.1Gauge
mongodbatlas.process.assertsNumber of assertions per second{assertions}/sGaugeassert_type
mongodbatlas.process.background_flushAmount of data flushed in the background1Gauge
mongodbatlas.process.cache.ioCache throughput (per second)ByGaugecache_direction
mongodbatlas.process.cache.ratioCache ratios represented as (%)%Gaugecache_ratio_type
mongodbatlas.process.cache.sizeCache sizesByUpDownCountercache_status
mongodbatlas.process.connectionsNumber of current connections{connections}UpDownCounter
mongodbatlas.process.cpu.children.normalized.usage.averageCPU Usage for child processes, normalized to pct1Gaugecpu_state
mongodbatlas.process.cpu.children.normalized.usage.maxCPU Usage for child processes, normalized to pct1Gaugecpu_state
mongodbatlas.process.cpu.children.usage.averageCPU Usage for child processes (%)1Gaugecpu_state
mongodbatlas.process.cpu.children.usage.maxCPU Usage for child processes (%)1Gaugecpu_state
mongodbatlas.process.cpu.normalized.usage.averageCPU Usage, normalized to pct1Gaugecpu_state
mongodbatlas.process.cpu.normalized.usage.maxCPU Usage, normalized to pct1Gaugecpu_state
mongodbatlas.process.cpu.usage.averageCPU Usage (%)1Gaugecpu_state
mongodbatlas.process.cpu.usage.maxCPU Usage (%)1Gaugecpu_state
mongodbatlas.process.cursorsNumber of cursors{cursors}Gaugecursor_state
mongodbatlas.process.db.document.rateDocument access rates{documents}/sGaugedocument_status
mongodbatlas.process.db.operations.rateDB Operation Rates{operations}/sGaugeoperation, cluster_role
mongodbatlas.process.db.operations.timeDB Operation TimesmsCounterexecution_type
mongodbatlas.process.db.query_executor.scannedScanned objects{objects}/sGaugescanned_type
mongodbatlas.process.db.query_targeting.scanned_per_returnedScanned objects per returned{scanned}/{returned}Gaugescanned_type
mongodbatlas.process.db.storageStorage used by the databaseByGaugestorage_status
mongodbatlas.process.global_lockNumber and status of locks{locks}Gaugeglobal_lock_state
mongodbatlas.process.index.btree_miss_ratioIndex miss ratio (%)1Gauge
mongodbatlas.process.index.countersIndexes{indexes}Gaugebtree_counter_type
mongodbatlas.process.journaling.commitsJournaling commits{commits}Gauge
mongodbatlas.process.journaling.data_filesData file sizesMiByGauge
mongodbatlas.process.journaling.writtenJournals writtenMiByGauge
mongodbatlas.process.memory.usageMemory UsageByGaugememory_state
mongodbatlas.process.network.ioNetwork IOBy/sGaugedirection
mongodbatlas.process.network.requestsNetwork requests{requests}Counter
mongodbatlas.process.oplog.rateExecution rate by operationGiBy/hGauge
mongodbatlas.process.oplog.timeExecution time by operationsGaugeoplog_type
mongodbatlas.process.page_faultsPage faults{faults}/sGaugememory_issue_type
mongodbatlas.process.restartsRestarts in last hour{restarts}/hGauge
mongodbatlas.process.ticketsTickets{tickets}Gaugeticket_type
mongodbatlas.system.cpu.normalized.usage.averageSystem CPU Normalized to pct1Gaugecpu_state
mongodbatlas.system.cpu.normalized.usage.maxSystem CPU Normalized to pct1Gaugecpu_state
mongodbatlas.system.cpu.usage.averageSystem CPU Usage (%)1Gaugecpu_state
mongodbatlas.system.cpu.usage.maxSystem CPU Usage (%)1Gaugecpu_state
mongodbatlas.system.fts.cpu.normalized.usageFull text search disk usage (%)1Gaugecpu_state
mongodbatlas.system.fts.cpu.usageFull-text search (%)1Gaugecpu_state
mongodbatlas.system.fts.disk.usedFull text search disk usageByGauge
mongodbatlas.system.fts.memory.usageFull-text searchMiByCountermemory_state
mongodbatlas.system.memory.usage.averageSystem Memory UsageKiByGaugememory_status
mongodbatlas.system.memory.usage.maxSystem Memory UsageKiByGaugememory_status
mongodbatlas.system.network.io.averageSystem Network IOBy/sGaugedirection
mongodbatlas.system.network.io.maxSystem Network IOBy/sGaugedirection
mongodbatlas.system.paging.io.averageSwap IO{pages}/sGaugedirection
mongodbatlas.system.paging.io.maxSwap IO{pages}/sGaugedirection
mongodbatlas.system.paging.usage.averageSwap usageKiByGaugememory_state
mongodbatlas.system.paging.usage.maxSwap usageKiByGaugememory_state

Attributes

Attribute NameDescriptionTypeValues
assert_typeMongoDB assertion typestringregular, warning, msg, user
btree_counter_typeDatabase index effectivenessstringaccesses, hits, misses
cache_directionWhether read into or written fromstringread_into, written_from
cache_ratio_typeCache ratio typestringcache_fill, dirty_fill
cache_statusCache statusstringdirty, used
cluster_roleWhether process is acting as replica or primarystringprimary, replica
cpu_stateCPU statestringkernel, user, nice, iowait, irq, softirq, guest, steal
cursor_stateWhether cursor is open or timed outstringtimed_out, open
directionNetwork traffic directionstringreceive, transmit
disk_directionMeasurement type for disk operationstringread, write, total
disk_statusDisk measurement typestringfree, used
document_statusStatus of documents in the databasestringreturned, inserted, updated, deleted
execution_typeType of commandstringreads, writes, commands
global_lock_stateWhich queue is lockedstringcurrent_queue_total, current_queue_readers, current_queue_writers
memory_issue_typeType of memory issue encounteredstringextra_info, global_accesses_not_in_memory, exceptions_thrown
memory_stateMemory usage typestringresident, virtual, mapped, computed, shared, free, used
memory_statusMemory measurement typestringavailable, buffers, cached, free, shared, used
object_typeMongoDB object typestringcollection, index, extent, object, view, storage, data
operationType of database operationstringcmd, query, update, delete, getmore, insert, scan_and_order, ttl_deleted
oplog_typeOplog typestringslave_lag_master_time, master_time, master_lag_time_diff
scanned_typeObjects or indexes scanned during querystringindex_items, objects
storage_statusViews on database sizestringtotal, data_size, index_size, data_size_wo_system
ticket_typeType of ticket availablestringavailable_reads, available_writes

Resource Attributes

Attribute NameDescriptionTypeEnabled
mongodb_atlas.cluster.nameCluster Namestring
mongodb_atlas.db.nameName of the Databasestring
mongodb_atlas.disk.partitionName of a disk partitionstring
mongodb_atlas.host.nameHostname of the processstring
mongodb_atlas.org_nameOrganization Namestring
mongodb_atlas.process.idID of the processstring
mongodb_atlas.process.portPort process is bound tostring
mongodb_atlas.process.type_nameProcess typestring
mongodb_atlas.project.idProject IDstring
mongodb_atlas.project.nameProject Namestring
mongodb_atlas.provider.nameProvider Namestring
mongodb_atlas.region.nameRegion Namestring
mongodb_atlas.user.aliasUser-friendly hostname of the cluster nodestring

Configuration

Example Configuration

mongodb_atlas:
  public_key: "my-public-key"
  private_key: "my-private-key"
  alerts:
    enabled: true
    mode: poll
    projects:
    - name: Project 0
      include_clusters: [Cluster0]
    poll_interval: 1m
  logs:
    enabled: true
    projects:
    - name: Project 0
      access_logs:
        enabled: true
        auth_result: true
        poll_interval: 1m
      collect_audit_logs: true
  events:
    projects:
      - name: Project 0
    organizations:
      - id: 5b478b3afc4625789ce616a3
    poll_interval: 1m
    page_size: 100
    max_pages: 25

Last generated: 2026-04-13