> ## Documentation Index
> Fetch the complete documentation index at: https://otel.fyi/llms.txt
> Use this file to discover all available pages before exploring further.

# Mongodbatlas

> OpenTelemetry receiver for Mongodbatlas

# Mongodbatlas Receiver

![Status](https://img.shields.io/badge/status-beta-yellow)

**Available in:** `contrib`

**Maintainers:** [@justinianvoss22](https://github.com/justinianvoss22), [@dyl10s](https://github.com/dyl10s), [@ishleenk17](https://github.com/ishleenk17)

**Source:** [opentelemetry-collector-contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/mongodbatlasreceiver)

## Supported Telemetry

![Logs](https://img.shields.io/badge/logs-beta-blue) ![Metrics](https://img.shields.io/badge/metrics-beta-green)

## 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](https://www.mongodb.com/docs/atlas/reference/api/logs/#logs) recommends a polling interval of 5 minutes.

* `base_url` (default [https://cloud.mongodb.com/](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](https://docs.atlas.mongodb.com/reference/api/process-measurements/))
* `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)
      * Audit logging must be [enabled for your MongoDB Atlas project](https://www.mongodb.com/docs/atlas/database-auditing/) in order to scrape audit logs.
    * `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](https://www.mongodb.com/docs/atlas/reference/api/events-orgs-get-all/#event-type-values) that the receiver will request from the API. If specified, the receiver will collect only the indicated types of events.

Examples:

Receive metrics:

```yaml theme={null}
receivers:
  mongodb_atlas:
    public_key: ${env:MONGODB_ATLAS_PUBLIC_KEY}
    private_key: ${env:MONGODB_ATLAS_PRIVATE_KEY}
```

Listen for alerts (default mode):

```yaml theme={null}
receivers:
  mongodb_atlas:
    alerts:
      enabled: true
      secret: "some_secret"
      endpoint: "0.0.0.0:7706"
```

Poll alerts from API:

```yaml theme={null}
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:

```yaml theme={null}
receivers:
  mongodb_atlas:
    logs:
      enabled: true
      projects: 
        - name: "project 1"
          collect_audit_logs: true
          collect_host_logs: true
```

Receive events:

```yaml theme={null}
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:

```yaml theme={null}
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 Name                                                      | Description                                                                                             | Unit                   | Type          | Attributes               |
| ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ---------------------- | ------------- | ------------------------ |
| ✅ `mongodbatlas.db.counts`                                       | Database feature size                                                                                   | \{objects}             | Gauge         | object\_type             |
| ✅ `mongodbatlas.db.size`                                         | Database feature size                                                                                   | By                     | Gauge         | object\_type             |
| ✅ `mongodbatlas.disk.partition.iops.average`                     | Disk partition iops                                                                                     | \{ops}/s               | Gauge         | disk\_direction          |
| ✅ `mongodbatlas.disk.partition.iops.max`                         | Disk partition iops                                                                                     | \{ops}/s               | Gauge         | disk\_direction          |
| ✅ `mongodbatlas.disk.partition.latency.average`                  | Disk partition latency                                                                                  | ms                     | Gauge         | disk\_direction          |
| ✅ `mongodbatlas.disk.partition.latency.max`                      | Disk partition latency                                                                                  | ms                     | Gauge         | disk\_direction          |
| ❌ `mongodbatlas.disk.partition.queue.depth`                      | Disk queue depth                                                                                        | 1                      | Gauge         |                          |
| ✅ `mongodbatlas.disk.partition.space.average`                    | Disk partition space                                                                                    | By                     | Gauge         | disk\_status             |
| ✅ `mongodbatlas.disk.partition.space.max`                        | Disk partition space                                                                                    | By                     | Gauge         | disk\_status             |
| ❌ `mongodbatlas.disk.partition.throughput`                       | Disk throughput                                                                                         | By/s                   | Gauge         | disk\_direction          |
| ✅ `mongodbatlas.disk.partition.usage.average`                    | Disk partition usage (%)                                                                                | 1                      | Gauge         | disk\_status             |
| ✅ `mongodbatlas.disk.partition.usage.max`                        | Disk partition usage (%)                                                                                | 1                      | Gauge         | disk\_status             |
| ✅ `mongodbatlas.disk.partition.utilization.average`              | The percentage of time during which requests are being issued to and serviced by the partition.         | 1                      | Gauge         |                          |
| ✅ `mongodbatlas.disk.partition.utilization.max`                  | The maximum percentage of time during which requests are being issued to and serviced by the partition. | 1                      | Gauge         |                          |
| ✅ `mongodbatlas.process.asserts`                                 | Number of assertions per second                                                                         | \{assertions}/s        | Gauge         | assert\_type             |
| ✅ `mongodbatlas.process.background_flush`                        | Amount of data flushed in the background                                                                | 1                      | Gauge         |                          |
| ✅ `mongodbatlas.process.cache.io`                                | Cache throughput (per second)                                                                           | By                     | Gauge         | cache\_direction         |
| ❌ `mongodbatlas.process.cache.ratio`                             | Cache ratios represented as (%)                                                                         | %                      | Gauge         | cache\_ratio\_type       |
| ✅ `mongodbatlas.process.cache.size`                              | Cache sizes                                                                                             | By                     | UpDownCounter | cache\_status            |
| ✅ `mongodbatlas.process.connections`                             | Number of current connections                                                                           | \{connections}         | UpDownCounter |                          |
| ✅ `mongodbatlas.process.cpu.children.normalized.usage.average`   | CPU Usage for child processes, normalized to pct                                                        | 1                      | Gauge         | cpu\_state               |
| ✅ `mongodbatlas.process.cpu.children.normalized.usage.max`       | CPU Usage for child processes, normalized to pct                                                        | 1                      | Gauge         | cpu\_state               |
| ✅ `mongodbatlas.process.cpu.children.usage.average`              | CPU Usage for child processes (%)                                                                       | 1                      | Gauge         | cpu\_state               |
| ✅ `mongodbatlas.process.cpu.children.usage.max`                  | CPU Usage for child processes (%)                                                                       | 1                      | Gauge         | cpu\_state               |
| ✅ `mongodbatlas.process.cpu.normalized.usage.average`            | CPU Usage, normalized to pct                                                                            | 1                      | Gauge         | cpu\_state               |
| ✅ `mongodbatlas.process.cpu.normalized.usage.max`                | CPU Usage, normalized to pct                                                                            | 1                      | Gauge         | cpu\_state               |
| ✅ `mongodbatlas.process.cpu.usage.average`                       | CPU Usage (%)                                                                                           | 1                      | Gauge         | cpu\_state               |
| ✅ `mongodbatlas.process.cpu.usage.max`                           | CPU Usage (%)                                                                                           | 1                      | Gauge         | cpu\_state               |
| ✅ `mongodbatlas.process.cursors`                                 | Number of cursors                                                                                       | \{cursors}             | Gauge         | cursor\_state            |
| ✅ `mongodbatlas.process.db.document.rate`                        | Document access rates                                                                                   | \{documents}/s         | Gauge         | document\_status         |
| ✅ `mongodbatlas.process.db.operations.rate`                      | DB Operation Rates                                                                                      | \{operations}/s        | Gauge         | operation, cluster\_role |
| ✅ `mongodbatlas.process.db.operations.time`                      | DB Operation Times                                                                                      | ms                     | Counter       | execution\_type          |
| ✅ `mongodbatlas.process.db.query_executor.scanned`               | Scanned objects                                                                                         | \{objects}/s           | Gauge         | scanned\_type            |
| ✅ `mongodbatlas.process.db.query_targeting.scanned_per_returned` | Scanned objects per returned                                                                            | \{scanned}/\{returned} | Gauge         | scanned\_type            |
| ✅ `mongodbatlas.process.db.storage`                              | Storage used by the database                                                                            | By                     | Gauge         | storage\_status          |
| ✅ `mongodbatlas.process.global_lock`                             | Number and status of locks                                                                              | \{locks}               | Gauge         | global\_lock\_state      |
| ✅ `mongodbatlas.process.index.btree_miss_ratio`                  | Index miss ratio (%)                                                                                    | 1                      | Gauge         |                          |
| ✅ `mongodbatlas.process.index.counters`                          | Indexes                                                                                                 | \{indexes}             | Gauge         | btree\_counter\_type     |
| ✅ `mongodbatlas.process.journaling.commits`                      | Journaling commits                                                                                      | \{commits}             | Gauge         |                          |
| ✅ `mongodbatlas.process.journaling.data_files`                   | Data file sizes                                                                                         | MiBy                   | Gauge         |                          |
| ✅ `mongodbatlas.process.journaling.written`                      | Journals written                                                                                        | MiBy                   | Gauge         |                          |
| ✅ `mongodbatlas.process.memory.usage`                            | Memory Usage                                                                                            | By                     | Gauge         | memory\_state            |
| ✅ `mongodbatlas.process.network.io`                              | Network IO                                                                                              | By/s                   | Gauge         | direction                |
| ✅ `mongodbatlas.process.network.requests`                        | Network requests                                                                                        | \{requests}            | Counter       |                          |
| ✅ `mongodbatlas.process.oplog.rate`                              | Execution rate by operation                                                                             | GiBy/h                 | Gauge         |                          |
| ✅ `mongodbatlas.process.oplog.time`                              | Execution time by operation                                                                             | s                      | Gauge         | oplog\_type              |
| ✅ `mongodbatlas.process.page_faults`                             | Page faults                                                                                             | \{faults}/s            | Gauge         | memory\_issue\_type      |
| ✅ `mongodbatlas.process.restarts`                                | Restarts in last hour                                                                                   | \{restarts}/h          | Gauge         |                          |
| ✅ `mongodbatlas.process.tickets`                                 | Tickets                                                                                                 | \{tickets}             | Gauge         | ticket\_type             |
| ✅ `mongodbatlas.system.cpu.normalized.usage.average`             | System CPU Normalized to pct                                                                            | 1                      | Gauge         | cpu\_state               |
| ✅ `mongodbatlas.system.cpu.normalized.usage.max`                 | System CPU Normalized to pct                                                                            | 1                      | Gauge         | cpu\_state               |
| ✅ `mongodbatlas.system.cpu.usage.average`                        | System CPU Usage (%)                                                                                    | 1                      | Gauge         | cpu\_state               |
| ✅ `mongodbatlas.system.cpu.usage.max`                            | System CPU Usage (%)                                                                                    | 1                      | Gauge         | cpu\_state               |
| ✅ `mongodbatlas.system.fts.cpu.normalized.usage`                 | Full text search disk usage (%)                                                                         | 1                      | Gauge         | cpu\_state               |
| ✅ `mongodbatlas.system.fts.cpu.usage`                            | Full-text search (%)                                                                                    | 1                      | Gauge         | cpu\_state               |
| ✅ `mongodbatlas.system.fts.disk.used`                            | Full text search disk usage                                                                             | By                     | Gauge         |                          |
| ✅ `mongodbatlas.system.fts.memory.usage`                         | Full-text search                                                                                        | MiBy                   | Counter       | memory\_state            |
| ✅ `mongodbatlas.system.memory.usage.average`                     | System Memory Usage                                                                                     | KiBy                   | Gauge         | memory\_status           |
| ✅ `mongodbatlas.system.memory.usage.max`                         | System Memory Usage                                                                                     | KiBy                   | Gauge         | memory\_status           |
| ✅ `mongodbatlas.system.network.io.average`                       | System Network IO                                                                                       | By/s                   | Gauge         | direction                |
| ✅ `mongodbatlas.system.network.io.max`                           | System Network IO                                                                                       | By/s                   | Gauge         | direction                |
| ✅ `mongodbatlas.system.paging.io.average`                        | Swap IO                                                                                                 | \{pages}/s             | Gauge         | direction                |
| ✅ `mongodbatlas.system.paging.io.max`                            | Swap IO                                                                                                 | \{pages}/s             | Gauge         | direction                |
| ✅ `mongodbatlas.system.paging.usage.average`                     | Swap usage                                                                                              | KiBy                   | Gauge         | memory\_state            |
| ✅ `mongodbatlas.system.paging.usage.max`                         | Swap usage                                                                                              | KiBy                   | Gauge         | memory\_state            |

## Attributes

| Attribute Name       | Description                                     | Type   | Values                                                                                   |
| -------------------- | ----------------------------------------------- | ------ | ---------------------------------------------------------------------------------------- |
| `assert_type`        | MongoDB assertion type                          | string | `regular`, `warning`, `msg`, `user`                                                      |
| `btree_counter_type` | Database index effectiveness                    | string | `accesses`, `hits`, `misses`                                                             |
| `cache_direction`    | Whether read into or written from               | string | `read_into`, `written_from`                                                              |
| `cache_ratio_type`   | Cache ratio type                                | string | `cache_fill`, `dirty_fill`                                                               |
| `cache_status`       | Cache status                                    | string | `dirty`, `used`                                                                          |
| `cluster_role`       | Whether process is acting as replica or primary | string | `primary`, `replica`                                                                     |
| `cpu_state`          | CPU state                                       | string | `kernel`, `user`, `nice`, `iowait`, `irq`, `softirq`, `guest`, `steal`                   |
| `cursor_state`       | Whether cursor is open or timed out             | string | `timed_out`, `open`                                                                      |
| `direction`          | Network traffic direction                       | string | `receive`, `transmit`                                                                    |
| `disk_direction`     | Measurement type for disk operation             | string | `read`, `write`, `total`                                                                 |
| `disk_status`        | Disk measurement type                           | string | `free`, `used`                                                                           |
| `document_status`    | Status of documents in the database             | string | `returned`, `inserted`, `updated`, `deleted`                                             |
| `execution_type`     | Type of command                                 | string | `reads`, `writes`, `commands`                                                            |
| `global_lock_state`  | Which queue is locked                           | string | `current_queue_total`, `current_queue_readers`, `current_queue_writers`                  |
| `memory_issue_type`  | Type of memory issue encountered                | string | `extra_info`, `global_accesses_not_in_memory`, `exceptions_thrown`                       |
| `memory_state`       | Memory usage type                               | string | `resident`, `virtual`, `mapped`, `computed`, `shared`, `free`, `used`                    |
| `memory_status`      | Memory measurement type                         | string | `available`, `buffers`, `cached`, `free`, `shared`, `used`                               |
| `object_type`        | MongoDB object type                             | string | `collection`, `index`, `extent`, `object`, `view`, `storage`, `data`                     |
| `operation`          | Type of database operation                      | string | `cmd`, `query`, `update`, `delete`, `getmore`, `insert`, `scan_and_order`, `ttl_deleted` |
| `oplog_type`         | Oplog type                                      | string | `slave_lag_master_time`, `master_time`, `master_lag_time_diff`                           |
| `scanned_type`       | Objects or indexes scanned during query         | string | `index_items`, `objects`                                                                 |
| `storage_status`     | Views on database size                          | string | `total`, `data_size`, `index_size`, `data_size_wo_system`                                |
| `ticket_type`        | Type of ticket available                        | string | `available_reads`, `available_writes`                                                    |

## Resource Attributes

| Attribute Name                    | Description                                | Type   | Enabled |
| --------------------------------- | ------------------------------------------ | ------ | ------- |
| `mongodb_atlas.cluster.name`      | Cluster Name                               | string | ❌       |
| `mongodb_atlas.db.name`           | Name of the Database                       | string | ✅       |
| `mongodb_atlas.disk.partition`    | Name of a disk partition                   | string | ✅       |
| `mongodb_atlas.host.name`         | Hostname of the process                    | string | ✅       |
| `mongodb_atlas.org_name`          | Organization Name                          | string | ✅       |
| `mongodb_atlas.process.id`        | ID of the process                          | string | ✅       |
| `mongodb_atlas.process.port`      | Port process is bound to                   | string | ✅       |
| `mongodb_atlas.process.type_name` | Process type                               | string | ✅       |
| `mongodb_atlas.project.id`        | Project ID                                 | string | ✅       |
| `mongodb_atlas.project.name`      | Project Name                               | string | ✅       |
| `mongodb_atlas.provider.name`     | Provider Name                              | string | ❌       |
| `mongodb_atlas.region.name`       | Region Name                                | string | ❌       |
| `mongodb_atlas.user.alias`        | User-friendly hostname of the cluster node | string | ❌       |

## Configuration

### Example Configuration

```yaml theme={null}
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-07-06*
