MongoDB metrics

Collect metrics from the MongoDB database

status: beta role: daemon role: sidecar delivery: at-least-once 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"
      ],
      "scrape_interval_secs": 15
    }
  }
}
[sources.my_source_id]
type = "mongodb_metrics"
endpoints = [ "mongodb://localhost:27017" ]
scrape_interval_secs = 15
---
sources:
  my_source_id:
    type: mongodb_metrics
    endpoints:
      - mongodb://localhost:27017
    scrape_interval_secs: 15
{
  "sources": {
    "my_source_id": {
      "type": "mongodb_metrics",
      "endpoints": [
        "mongodb://localhost:27017"
      ],
      "scrape_interval_secs": 15,
      "namespace": "mongodb"
    }
  }
}
[sources.my_source_id]
type = "mongodb_metrics"
endpoints = [ "mongodb://localhost:27017" ]
scrape_interval_secs = 15
namespace = "mongodb"
---
sources:
  my_source_id:
    type: mongodb_metrics
    endpoints:
      - mongodb://localhost:27017
    scrape_interval_secs: 15
    namespace: mongodb

endpoints

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

namespace

optional string literal
The namespace of metrics. Disabled if empty.
default: mongodb

scrape_interval_secs

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

Output

Metrics

assets_total

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

bson_parse_error_total

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

connections

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

extra_info_heap_usage_bytes

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

extra_info_page_faults

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

instance_local_time

gauge
The ISODate representing the current time, according to the server, in UTC.
endpoint required
The absolute path of the originating file.
host required
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 required
The absolute path of the originating file.
host required
The hostname of the MongoDB server.

instance_uptime_seconds_total

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

memory

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

mongod_global_lock_active_clients

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

mongod_global_lock_current_queue

gauge
Number of operations queued because of a lock.
endpoint required
The absolute path of the originating file.
host required
The hostname of the MongoDB server.
type required
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 required
The absolute path of the originating file.
host required
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 required
The absolute path of the originating file.
host required
The hostname of the MongoDB server.
mode required
Lock mode.
type required
Lock type.

mongod_metrics_cursor_open

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

mongod_metrics_cursor_timed_out_total

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

mongod_metrics_document_total

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

mongod_metrics_get_last_error_wtime_num

gauge
The total number of getLastError operations with a specified write concern.
endpoint required
The absolute path of the originating file.
host required
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 required
The absolute path of the originating file.
host required
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 required
The absolute path of the originating file.
host required
The hostname of the MongoDB server.

mongod_metrics_operation_total

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

mongod_metrics_query_executor_total

counter
Data from query execution system.
endpoint required
The absolute path of the originating file.
host required
The hostname of the MongoDB server.
state required
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 required
The absolute path of the originating file.
host required
The hostname of the MongoDB server.

mongod_metrics_repl_apply_batches_num_total

counter
The total number of batches applied across all databases.
endpoint required
The absolute path of the originating file.
host required
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 required
The absolute path of the originating file.
host required
The hostname of the MongoDB server.

mongod_metrics_repl_apply_ops_total

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

mongod_metrics_repl_buffer_count

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

mongod_metrics_repl_buffer_max_size_bytes_total

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

mongod_metrics_repl_buffer_size_bytes

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

mongod_metrics_repl_executor_queue

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

mongod_metrics_repl_executor_unsignaled_events

gauge
Number of unsignaled events in the replication executor.
endpoint required
The absolute path of the originating file.
host required
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 required
The absolute path of the originating file.
host required
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 required
The absolute path of the originating file.
host required
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 required
The absolute path of the originating file.
host required
The hostname of the MongoDB server.

mongod_metrics_repl_network_ops_total

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

mongod_metrics_repl_network_readers_created_total

counter
The total number of oplog query processes created.
endpoint required
The absolute path of the originating file.
host required
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 required
The absolute path of the originating file.
host required
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 required
The absolute path of the originating file.
host required
The hostname of the MongoDB server.

mongod_op_latencies_histogram

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

mongod_op_latencies_latency

gauge
A 64-bit integer giving the total combined latency in microseconds.
endpoint required
The absolute path of the originating file.
host required
The hostname of the MongoDB server.
type required
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 required
The absolute path of the originating file.
host required
The hostname of the MongoDB server.
type required
Latency type.

mongod_storage_engine

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

mongod_wiredtiger_blockmanager_blocks_total

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

mongod_wiredtiger_blockmanager_bytes_total

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

mongod_wiredtiger_cache_bytes

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

mongod_wiredtiger_cache_bytes_total

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

mongod_wiredtiger_cache_evicted_total

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

mongod_wiredtiger_cache_max_bytes

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

mongod_wiredtiger_cache_overhead_percent

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

mongod_wiredtiger_cache_pages

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

mongod_wiredtiger_cache_pages_total

counter
Pages in the cache.
endpoint required
The absolute path of the originating file.
host required
The hostname of the MongoDB server.
type required
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 required
The absolute path of the originating file.
host required
The hostname of the MongoDB server.
type required
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 required
The absolute path of the originating file.
host required
The hostname of the MongoDB server.
type required
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 required
The absolute path of the originating file.
host required
The hostname of the MongoDB server.
type required
Transactions type.

mongod_wiredtiger_log_bytes_total

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

mongod_wiredtiger_log_operations_total

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

mongod_wiredtiger_log_records_scanned_total

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

mongod_wiredtiger_log_records_total

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

mongod_wiredtiger_session_open_sessions

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

mongod_wiredtiger_transactions_checkpoint_seconds

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

mongod_wiredtiger_transactions_checkpoint_seconds_total

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

mongod_wiredtiger_transactions_running_checkpoints

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

mongod_wiredtiger_transactions_total

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

mongodb_op_counters_repl_total

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

mongodb_op_counters_total

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

network_bytes_total

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

network_metrics_num_requests_total

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

up

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

Telemetry

Metrics

link

collect_completed_total

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

collect_duration_seconds

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

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 required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
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 required
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 required
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 required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

component_sent_events_total

counter
The total number of events emitted by this component.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

events_in_total

counter
The number of events accepted by this component either from tagged origins like file and uri, or cumulatively from other origins. This metric is deprecated and will be removed in a future version. Use component_received_events_total instead.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
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 required
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 required
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.

events_out_total

counter
The total number of events emitted by this component. This metric is deprecated and will be removed in a future version. Use component_sent_events_total instead.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

parse_errors_total

counter
The total number of errors parsing metrics for this component.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

request_errors_total

counter
The total number of requests errors for this component.
host required
The hostname of the system Vector is running on.
pid required
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.