MongoDB metrics

Collect metrics from the MongoDB database

status: stable role: daemon role: sidecar delivery: at-least-once acknowledgements: no egress: batch state: stateless output: metrics

Requirements

User from endpoint should have enough privileges for running serverStatus command.

Configuration

Example configurations

{
  "sources": {
    "my_source_id": {
      "type": "mongodb_metrics",
      "endpoints": [
        "mongodb://localhost:27017"
      ]
    }
  }
}
[sources.my_source_id]
type = "mongodb_metrics"
endpoints = [ "mongodb://localhost:27017" ]
sources:
  my_source_id:
    type: mongodb_metrics
    endpoints:
      - mongodb://localhost:27017
{
  "sources": {
    "my_source_id": {
      "type": "mongodb_metrics",
      "endpoints": [
        "mongodb://localhost:27017"
      ],
      "namespace": "mongodb",
      "scrape_interval_secs": 15
    }
  }
}
[sources.my_source_id]
type = "mongodb_metrics"
endpoints = [ "mongodb://localhost:27017" ]
namespace = "mongodb"
scrape_interval_secs = 15
sources:
  my_source_id:
    type: mongodb_metrics
    endpoints:
      - mongodb://localhost:27017
    namespace: mongodb
    scrape_interval_secs: 15

endpoints

required [string]

A list of MongoDB instances to scrape.

Each endpoint must be in the Connection String URI Format.

Array string literal
Examples
[
  "mongodb://localhost:27017"
]

namespace

optional string literal

Overrides the default namespace for the metrics emitted by the source.

If set to an empty string, no namespace is added to the metrics.

By default, mongodb is used.

default: mongodb

scrape_interval_secs

optional uint
The interval between scrapes, in seconds.
default: 15 (seconds)

Outputs

<component_id>

Default output stream of the component. Use this component’s ID as an input to downstream transforms and sinks.

Output Data

Metrics

assets_total

counter
Number of assertions raised since the MongoDB process started.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
The assertion type

bson_parse_error_total

counter
The total number of BSON parsing errors.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

connections

gauge
Number of connections in some state.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
state
The connection state

extra_info_heap_usage_bytes

gauge
The total size in bytes of heap space used by the database process.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

extra_info_page_faults

gauge
The total number of page faults.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

instance_local_time

gauge
The ISODate representing the current time, according to the server, in UTC.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

instance_uptime_estimate_seconds_total

gauge
The uptime in seconds as calculated from MongoDB’s internal course-grained time keeping system.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

instance_uptime_seconds_total

gauge
The number of seconds that the current MongoDB process has been active.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

memory

gauge
Current memory unsage.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Memory type

mongod_global_lock_active_clients

gauge
Number of connected clients and the read and write operations performed by these clients.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Number type.

mongod_global_lock_current_queue

gauge
Number of operations queued because of a lock.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Number type.

mongod_global_lock_total_time_seconds

counter
The time since the database last started and created the globalLock. This is roughly equivalent to total server uptime.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_locks_time_acquiring_global_seconds_total

counter
Amount of time that any database has spent waiting for the global lock.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
mode
Lock mode.
type
Lock type.

mongod_metrics_cursor_open

gauge
Number of cursors.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
state
Cursor state.

mongod_metrics_cursor_timed_out_total

counter
The total number of cursors that have timed out since the server process started.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_metrics_document_total

counter
Document access and modification patterns.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
state
Document state.

mongod_metrics_get_last_error_wtime_num

gauge
The total number of getLastError operations with a specified write concern.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_metrics_get_last_error_wtime_seconds_total

counter
The total amount of time that the mongod has spent performing getLastError operations.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_metrics_get_last_error_wtimeouts_total

counter
The number of times that write concern operations have timed out as a result of the wtimeout threshold to getLastError.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_metrics_operation_total

counter
Update and query operations that MongoDB handles using special operation types.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Operation type.

mongod_metrics_query_executor_total

counter
Data from query execution system.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
state
Query state.

mongod_metrics_record_moves_total

counter
Moves reports the total number of times documents move within the on-disk representation of the MongoDB data set. Documents move as a result of operations that increase the size of the document beyond their allocated record size.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_metrics_repl_apply_batches_num_total

counter
The total number of batches applied across all databases.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_metrics_repl_apply_batches_seconds_total

counter
The total amount of time the mongod has spent applying operations from the oplog.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_metrics_repl_apply_ops_total

counter
The total number of oplog operations applied.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_metrics_repl_buffer_count

counter
The current number of operations in the oplog buffer.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_metrics_repl_buffer_max_size_bytes_total

counter
The maximum size of the buffer.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_metrics_repl_buffer_size_bytes

counter
The current size of the contents of the oplog buffer.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_metrics_repl_executor_queue

gauge
Number of queued operations in the replication executor.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Queue type.

mongod_metrics_repl_executor_unsignaled_events

gauge
Number of unsignaled events in the replication executor.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_metrics_repl_network_bytes_total

counter
The total amount of data read from the replication sync source.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_metrics_repl_network_getmores_num_total

counter
The total number of getmore operations, which are operations that request an additional set of operations from the replication sync source.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_metrics_repl_network_getmores_seconds_total

counter
The total amount of time required to collect data from getmore operations.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_metrics_repl_network_ops_total

counter
The total number of operations read from the replication source.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_metrics_repl_network_readers_created_total

counter
The total number of oplog query processes created.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_metrics_ttl_deleted_documents_total

counter
The total number of documents deleted from collections with a ttl index.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_metrics_ttl_passes_total

counter
The number of times the background process removes documents from collections with a ttl index.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_op_latencies_histogram

gauge
Latency statistics.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
micros
Bucket.
type
Latency type.

mongod_op_latencies_latency

gauge
A 64-bit integer giving the total combined latency in microseconds.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Latency type.

mongod_op_latencies_ops_total

gauge
A 64-bit integer giving the total number of operations performed on the collection since startup.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Latency type.

mongod_storage_engine

gauge
The name of the current storage engine.
endpoint
The absolute path of the originating file.
engine
Engine name.
host
The hostname of the MongoDB server.

mongod_wiredtiger_blockmanager_blocks_total

counter
Statistics on the block manager operations.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Operation type.

mongod_wiredtiger_blockmanager_bytes_total

counter
Statistics on the block manager operations.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Operation type.

mongod_wiredtiger_cache_bytes

gauge
Statistics on the cache and page evictions from the cache.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Statistics type.

mongod_wiredtiger_cache_bytes_total

counter
Statistics on the cache and page evictions from the cache.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Statistics type.

mongod_wiredtiger_cache_evicted_total

counter
Statistics on the cache and page evictions from the cache.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Statistics type.

mongod_wiredtiger_cache_max_bytes

gauge
Maximum cache size.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_wiredtiger_cache_overhead_percent

gauge
Percentage overhead.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_wiredtiger_cache_pages

gauge
Pages in the cache.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Pages type.

mongod_wiredtiger_cache_pages_total

counter
Pages in the cache.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Pages type.

mongod_wiredtiger_concurrent_transactions_available_tickets

gauge
Information on the number of concurrent of read and write transactions allowed into the WiredTiger storage engine
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Transactions type.

mongod_wiredtiger_concurrent_transactions_out_tickets

gauge
Information on the number of concurrent of read and write transactions allowed into the WiredTiger storage engine
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Transactions type.

mongod_wiredtiger_concurrent_transactions_total_tickets

gauge
Information on the number of concurrent of read and write transactions allowed into the WiredTiger storage engine
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Transactions type.

mongod_wiredtiger_log_bytes_total

counter
Statistics on WiredTiger’s write ahead log (i.e. the journal).
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Bytes type.

mongod_wiredtiger_log_operations_total

counter
Statistics on WiredTiger’s write ahead log (i.e. the journal).
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Operations type.

mongod_wiredtiger_log_records_scanned_total

counter
Statistics on WiredTiger’s write ahead log (i.e. the journal).
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Scanned records type.

mongod_wiredtiger_log_records_total

counter
Statistics on WiredTiger’s write ahead log (i.e. the journal).
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_wiredtiger_session_open_sessions

counter
Open session count.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_wiredtiger_transactions_checkpoint_seconds

gauge
Statistics on transaction checkpoints and operations.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Checkpoint type.

mongod_wiredtiger_transactions_checkpoint_seconds_total

counter
Statistics on transaction checkpoints and operations.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_wiredtiger_transactions_running_checkpoints

counter
Statistics on transaction checkpoints and operations.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

mongod_wiredtiger_transactions_total

counter
Statistics on transaction checkpoints and operations.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Transactions type.

mongodb_op_counters_repl_total

counter
Database replication operations by type since the mongod instance last started.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Counter type.

mongodb_op_counters_total

counter
Database operations by type since the mongod instance last started.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
type
Counter type.

network_bytes_total

counter
The number of bytes that reflects the amount of network traffic.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.
state
Bytes state.

network_metrics_num_requests_total

counter
The total number of distinct requests that the server has received.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

up

gauge
If the MongoDB server is up or not.
endpoint
The absolute path of the originating file.
host
The hostname of the MongoDB server.

Telemetry

Metrics

link

collect_completed_total

counter
The total number of metrics collections completed for this component.
host optional
The hostname of the system Vector is running on.
pid optional
The process ID of the Vector instance.

collect_duration_seconds

histogram
The duration spent collecting of metrics for this component.
host optional
The hostname of the system Vector is running on.
pid optional
The process ID of the Vector instance.

component_discarded_events_total

counter
The number of events dropped by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
intentional
True if the events were discarded intentionally, like a filter transform, or false if due to an error.
pid optional
The process ID of the Vector instance.

component_errors_total

counter
The total number of errors encountered by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
error_type
The type of the error
host optional
The hostname of the system Vector is running on.
pid optional
The process ID of the Vector instance.
stage
The stage within the component at which the error occurred.

component_received_bytes_total

counter
The number of raw bytes accepted by this component from source origins.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
container_name optional
The name of the container from which the data originated.
file optional
The file from which the data originated.
host optional
The hostname of the system Vector is running on.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the data originated.
peer_path optional
The pathname from which the data originated.
pid optional
The process ID of the Vector instance.
pod_name optional
The name of the pod from which the data originated.
uri optional
The sanitized URI from which the data originated.

component_received_event_bytes_total

counter
The number of event bytes accepted by this component either from tagged origins like file and uri, or cumulatively from other origins.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
container_name optional
The name of the container from which the data originated.
file optional
The file from which the data originated.
host optional
The hostname of the system Vector is running on.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the data originated.
peer_path optional
The pathname from which the data originated.
pid optional
The process ID of the Vector instance.
pod_name optional
The name of the pod from which the data originated.
uri optional
The sanitized URI from which the data originated.

component_received_events_count

histogram

A histogram of the number of events passed in each internal batch in Vector’s internal topology.

Note that this is separate than sink-level batching. It is mostly useful for low level debugging performance issues in Vector due to small internal batches.

component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
container_name optional
The name of the container from which the data originated.
file optional
The file from which the data originated.
host optional
The hostname of the system Vector is running on.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the data originated.
peer_path optional
The pathname from which the data originated.
pid optional
The process ID of the Vector instance.
pod_name optional
The name of the pod from which the data originated.
uri optional
The sanitized URI from which the data originated.

component_received_events_total

counter
The number of events accepted by this component either from tagged origins like file and uri, or cumulatively from other origins.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
container_name optional
The name of the container from which the data originated.
file optional
The file from which the data originated.
host optional
The hostname of the system Vector is running on.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the data originated.
peer_path optional
The pathname from which the data originated.
pid optional
The process ID of the Vector instance.
pod_name optional
The name of the pod from which the data originated.
uri optional
The sanitized URI from which the data originated.

component_sent_event_bytes_total

counter
The total number of event bytes emitted by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
output optional
The specific output of the component.
pid optional
The process ID of the Vector instance.

component_sent_events_total

counter
The total number of events emitted by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
output optional
The specific output of the component.
pid optional
The process ID of the Vector instance.

source_lag_time_seconds

histogram
The difference between the timestamp recorded in each event and the time when it was ingested, expressed as fractional seconds.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
pid optional
The process ID of the Vector instance.

How it works

Context

By default, the mongodb_metrics source augments events with helpful context keys.

MongoDB serverStatus command

The serverStatus command returns a document that provides an overview of the database’s state. The output fields vary depending on the version of MongoDB, underlying operating system platform, the storage engine, and the kind of node, including mongos, mongod or replica set member.

State

This component is stateless, meaning its behavior is consistent across each input.