mongo

package
v0.0.0-...-6ade924 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

README

MongoDB monitoring with Netdata

MongoDB MongoDB is a source-available cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with optional schemas. MongoDB is developed by MongoDB Inc. and licensed under the Server Side Public License (SSPL).

source: Wikipedia


This module monitors one or more MongoDB instances, depending on your configuration.

It collects information and statistics about the server executing the following commands:

Prerequisites

Create a read-only user for Netdata in the admin database.

  • Authenticate as the admin user.

    use admin
    db.auth("admin", "<MONGODB_ADMIN_PASSWORD>")
    
  • Create a user.

    # MongoDB 2.x.
    db.addUser("netdata", "<UNIQUE_PASSWORD>", true)
    
    # MongoDB 3.x or higher.
    db.createUser({
      "user":"netdata",
      "pwd": "<UNIQUE_PASSWORD>",
      "roles" : [
        {role: 'read', db: 'admin' },
        {role: 'clusterMonitor', db: 'admin'},
        {role: 'read', db: 'local' }
      ]
    })
    

Metrics

All metrics have "mongodb." prefix.

  • WireTiger metrics are available only if WiredTiger is used as the storage engine.
  • Sharding metris are available on shards only for mongos
Metric Scope Dimensions Units
operations global insert, query, update, delete, getmore, command ops/s
operations_latency global reads, writes, commands milliseconds
connections global current, available connections
connections_rate global created connections/s
connections_state global active, threaded, exhaustIsMaster, exhaustHello, awaiting_topology_changes connections
network_io global in, out bytes/s
network_requests global requests requests/s
page_faults global page_faults page_faults/s
tcmalloc_generic global current_allocated, heap_size bytes
tcmalloc global pageheap_free, pageheap_unmapped, total_threaded_cache, free, pageheap_committed, pageheap_total_commit, pageheap_decommit, pageheap_reserve bytes
asserts global regular, warning, msg, user, tripwire, rollovers asserts/s
current_transactions global active, inactive, open, prepared transactions
shard_commit_types global no_shard_init, no_shard_successful, single_shard_init, single_shard_successful, shard_write_init, shard_write_successful, two_phase_init, two_phase_successful commits
active_clients global readers, writers clients
queued_operations global readers, writers operation
locks global global_read, global_write, database_read, database_write, collection_read, collection_write operation
flow_control_timings global acquiring, lagged milliseconds
wiredtiger_blocks global read, read_via_memory_map_api, read_via_system_call_api, written, written_for_checkpoint, written_via_memory_map_api bytes
wiredtiger_cache global allocated_for_updates, read_into_cache, written_from_cache bytes
wiredtiger_capacity global due_to_total_capacity, during_checkpoint, during_eviction, during_logging, during_read usec
wiredtiger_connection global memory_allocations, memory_frees, memory_re_allocations ops/s
wiredtiger_cursor global open_count, cached_count, bulk_loaded_insert_calls, close_calls_that_result_in_cache, create_calls, insert_calls, modify_calls, next_calls, operation_restarted, prev_calls, remove_calls, reserve_calls, cursor_reset_calls, search_calls, search_history_store_calls, search_near_calls, sweep_buckets, sweep_cursors_closed, sweep_cursors_examined, sweeps, truncate_calls, update_calls calls/s
wiredtiger_lock global checkpoint, dhandle_read, dhandle_write, durable_timestamp_queue_read, durable_timestamp_queue_write, metadata, read_timestamp_queue_read, read_timestamp_queue_write, schema, table_read, table_write, txn_global_read ops/s
wiredtiger_lock_duration global checkpoint, checkpoint_internal_thread, dhandle_application_thread, dhandle_internal_thread, durable_timestamp_queue_application_thread, durable_timestamp_queue_internal_thread, metadata_application_thread, metadata_internal_thread, read_timestamp_queue_application_thread, read_timestamp_queue_internal_thread, schema_application_thread, schema_internal_thread operation
wiredtiger_log_ops global flush, force_write, force_write_skipped, scan, sync, sync_dir, write ops/s
wiredtiger_transactions global prepared, query_timestamp, rollback_to_stable, set_timestamp, begins, sync, committed, rolled back transactions/s
database_collections global a dimension per database collections
database_indexes global a dimension per database indexes
database_views global a dimension per database views
database_documents global a dimension per database documents
database_storage_size global a dimension per database bytes
replication_lag global a dimension per replication member milliseconds
replication_heartbeat_latency global a dimension per replication member milliseconds
replication_node_ping global a dimension per replication member milliseconds
shard_nodes_count global shard_aware, shard_unaware nodes
shard_databases_status global partitioned, un-partitioned databases
chunks global a dimension per shard chunks

Configuration

Edit the go.d/mongodb.conf configuration file using edit-config from the Netdata config directory, which is typically at /etc/netdata.

cd /etc/netdata   # Replace this path with your Netdata config directory, if different
sudo ./edit-config go.d/mongodb.conf

Sample using connection string:

This is the preferred way

uri: 'mongodb://localhost:27017'

If no configuration is given, module will attempt to connect to mongodb daemon on 127.0.0.1:27017 address

For all available options, see the mongodb collector's configuration file.

Troubleshooting

To troubleshoot issues with the mongodb collector, run the go.d.plugin with the debug option enabled. The output should give you clues as to why the collector isn't working.

  • Navigate to the plugins.d directory, usually at /usr/libexec/netdata/plugins.d/. If that's not the case on your system, open netdata.conf and look for the plugins setting under [directories].

    cd /usr/libexec/netdata/plugins.d/
    
  • Switch to the netdata user.

    sudo -u netdata -s
    
  • Run the go.d.plugin to debug the collector:

    ./go.d.plugin -d -m mongodb
    

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asserts

type Asserts struct {
	Regular   *int64 `bson:"regular" stm:"regular"`
	Warning   *int64 `bson:"warning" stm:"warning"`
	Msg       *int64 `bson:"msg" stm:"msg"`
	User      *int64 `bson:"user" stm:"user"`
	Tripwire  *int64 `bson:"tripwire" stm:"tripwire"`
	Rollovers *int64 `bson:"rollovers" stm:"rollovers"`
}

type CommitType

type CommitType struct {
	Initiated  int64 `json:"initiated" stm:"initiated"`
	Successful int64 `json:"successful" stm:"successful"`
}

type CommitTypes

type CommitTypes struct {
	NoShards         CommitType `bson:"noShards" stm:"no_shards"`
	SingleShard      CommitType `bson:"singleShard" stm:"single_shard"`
	SingleWriteShard CommitType `bson:"singleWriteShard" stm:"single_write_shard"`
	TwoPhaseCommit   CommitType `bson:"twoPhaseCommit" stm:"two_phase"`
}

type Config

type Config struct {
	URI       string             `yaml:"uri"`
	Timeout   time.Duration      `yaml:"timeout"`
	Databases matcher.SimpleExpr `yaml:"databases"`
}

type Connections

type Connections struct {
	Current                 *int64 `bson:"current" stm:"current"`
	Available               *int64 `bson:"available" stm:"available"`
	TotalCreated            *int64 `bson:"totalCreated" stm:"total_created"`
	Active                  *int64 `bson:"active" stm:"active"`
	Threaded                *int64 `bson:"threaded" stm:"threaded"`
	ExhaustIsMaster         *int64 `bson:"exhaustIsMaster" stm:"exhaustIsMaster"`
	ExhaustHello            *int64 `bson:"exhaustHello" stm:"exhaustHello"`
	AwaitingTopologyChanges *int64 `bson:"awaitingTopologyChanges" stm:"awaitingTopologyChanges"`
}

type ExtraInfo

type ExtraInfo struct {
	PageFaults *int64 `bson:"page_faults" stm:"page_faults"`
}

type FlowControl

type FlowControl struct {
	TargetRateLimit     *int64 `bson:"targetRateLimit" stm:"target_rate_limit"`
	TimeAcquiringMicros *int64 `bson:"timeAcquiringMicros" stm:"time_acquiring_micros"`
}

type Generic

type Generic struct {
	CurrentAllocatedBytes *int64 `bson:"current_allocated_bytes" stm:"current_allocated"`
	HeapSize              *int64 `bson:"heap_size" stm:"heap_size"`
}

type GlobalLock

type GlobalLock struct {
	ActiveClients *struct {
		Readers *int64 `bson:"readers" stm:"readers"`
		Writers *int64 `bson:"writers" stm:"writers"`
	} `bson:"activeClients" stm:"active_clients"`
	CurrentQueue *struct {
		Readers *int64 `bson:"readers" stm:"readers"`
		Writers *int64 `bson:"writers" stm:"writers"`
	} `bson:"currentQueue" stm:"current_queue"`
}

type Locks

type Locks struct {
	Global *struct {
		AcquireCount struct {
			R *int64 `bson:"r" stm:"read"`
			W *int64 `bson:"W" stm:"write"`
		} `bson:"acquireCount" stm:""`
	} `bson:"Global" stm:"global"`
	Database *struct {
		AcquireCount struct {
			R *int64 `bson:"r" stm:"read"`
			W *int64 `bson:"W" stm:"write"`
		} `bson:"acquireCount" stm:""`
	} `bson:"Database" stm:"database"`
	Collection *struct {
		AcquireCount struct {
			R *int64 `bson:"r" stm:"read"`
			W *int64 `bson:"W" stm:"write"`
		} `bson:"acquireCount" stm:""`
	} `bson:"Collection" stm:"collection"`
}

type Mongo

type Mongo struct {
	module.Base
	Config `yaml:",inline"`
	// contains filtered or unexported fields
}

func New

func New() *Mongo

func (*Mongo) Charts

func (m *Mongo) Charts() *module.Charts

func (*Mongo) Check

func (m *Mongo) Check() bool

func (*Mongo) Cleanup

func (m *Mongo) Cleanup()

func (*Mongo) Collect

func (m *Mongo) Collect() map[string]int64

func (*Mongo) Init

func (m *Mongo) Init() bool

type Network

type Network struct {
	BytesIn     *int64 `bson:"bytesIn" stm:"bytes_in"`
	BytesOut    *int64 `bson:"bytesOut" stm:"bytes_out"`
	NumRequests *int64 `bson:"numRequests" stm:"requests"`
}

type OpLatencies

type OpLatencies struct {
	Reads *struct {
		Latency *int64 `bson:"latency" stm:""`
	} `bson:"reads" stm:"read"`
	Writes *struct {
		Latency *int64 `bson:"latency" stm:""`
	} `bson:"writes" stm:"write"`
	Commands *struct {
		Latency *int64 `bson:"latency" stm:""`
	} `bson:"commands" stm:"command"`
}

type Opcounters

type Opcounters struct {
	Insert  *int64 `bson:"insert" stm:"insert"`
	Query   *int64 `bson:"query" stm:"query"`
	Update  *int64 `bson:"update" stm:"update"`
	Delete  *int64 `bson:"delete" stm:"delete"`
	Getmore *int64 `bson:"getmore" stm:"getmore"`
	Command *int64 `bson:"command" stm:"command"`
}

type ServerStatusTcmalloc

type ServerStatusTcmalloc struct {
	Generic  *Generic          `bson:"generic" stm:"generic"`
	Tcmalloc *TcmallocTcmalloc `bson:"tcmalloc" stm:"tcmalloc"`
}

type TcmallocTcmalloc

type TcmallocTcmalloc struct {
	PageheapFreeBytes          *int64 `bson:"pageheap_free_bytes" stm:"pageheap_free"`
	PageheapUnmappedBytes      *int64 `bson:"pageheap_unmapped_bytes" stm:"pageheap_unmapped"`
	MaxTotalThreadCacheBytes   *int64 `bson:"max_total_thread_cache_bytes" stm:"max_total_thread_cache"`
	TotalFreeBytes             *int64 `bson:"total_free_bytes" stm:"total_free"`
	PageheapCommittedBytes     *int64 `bson:"pageheap_committed_bytes" stm:"pageheap_committed"`
	PageheapTotalCommitBytes   *int64 `bson:"pageheap_total_commit_bytes" stm:"pageheap_total_commit"`
	PageheapTotalDecommitBytes *int64 `bson:"pageheap_total_decommit_bytes" stm:"pageheap_total_decommit"`
	PageheapTotalReserveBytes  *int64 `bson:"pageheap_total_reserve_bytes" stm:"pageheap_total_reserve"`
}

type Transactions

type Transactions struct {
	CurrentActive   *int64       `bson:"currentActive" stm:"active"`
	CurrentInactive *int64       `bson:"currentInactive" stm:"inactive"`
	CurrentOpen     *int64       `bson:"currentOpen" stm:"open"`
	CurrentPrepared *int64       `bson:"currentPrepared" stm:"prepared"`
	CommitTypes     *CommitTypes `bson:"commitTypes" stm:"commit_types"`
}

type WiredTiger

type WiredTiger struct {
	BlockManager *struct {
		BytesRead                    int `bson:"bytes read" stm:"read"`
		BytesReadViaMemoryMapAPI     int `bson:"bytes read via memory map API" stm:"read_via_memory"`
		BytesReadViaSystemCallAPI    int `bson:"bytes read via system call API" stm:"read_via_system_api"`
		BytesWritten                 int `bson:"bytes written" stm:"written"`
		BytesWrittenForCheckpoint    int `bson:"bytes written for checkpoint" stm:"written_for_checkpoint"`
		BytesWrittenViaMemoryMapAPI  int `bson:"bytes written via memory map API" stm:"written_via_memory"`
		BytesWrittenViaSystemCallAPI int `bson:"bytes written via system call API" stm:"written_via_system_api"`
	} `bson:"block-manager" json:"block-manager" stm:"block_manager"`
	Cache *struct {
		BytesAllocatedForUpdates int `bson:"bytes allocated for updates" stm:"alloccated"`
		BytesReadIntoCache       int `bson:"bytes read into cache" stm:"read"`
		BytesWrittenFromCache    int `bson:"bytes written from cache" stm:"write"`
	} `bson:"cache" stm:"cache"`
	Capacity *struct {
		TimeWaitingDueToTotalCapacityUsecs int `bson:"time waiting due to total capacity (usecs)" stm:"wait_capacity"`
		TimeWaitingDuringCheckpointUsecs   int `bson:"time waiting during checkpoint (usecs)" stm:"wait_checkpoint"`
		TimeWaitingDuringEvictionUsecs     int `bson:"time waiting during eviction (usecs)" stm:"wait_eviction"`
		TimeWaitingDuringLoggingUsecs      int `bson:"time waiting during logging (usecs)" stm:"wait_logging"`
		TimeWaitingDuringReadUsecs         int `bson:"time waiting during read (usecs)" stm:"wait_read"`
	} `bson:"capacity" stm:"capacity"`
	Connection *struct {
		MemoryAllocations   int `bson:"memory allocations" stm:"allocations"`
		MemoryFrees         int `bson:"memory frees" stm:"frees"`
		MemoryReAllocations int `bson:"memory re-allocations" stm:"reallocations"`
	} `bson:"connection" stm:"connection"`
	Cursor *struct {
		CachedCursorCount                 int `bson:"cached cursor count" stm:"count"`
		CursorBulkLoadedCursorInsertCalls int `bson:"cursor bulk loaded cursor insert calls" stm:"bulk"`
		CursorCloseCallsThatResultInCache int `bson:"cursor close calls that result in cache" stm:"close"`
		CursorCreateCalls                 int `bson:"cursor create calls" stm:"create"`
		CursorInsertCalls                 int `bson:"cursor insert calls" stm:"insert"`
		CursorModifyCalls                 int `bson:"cursor modify calls" stm:"modify"`
		CursorNextCalls                   int `bson:"cursor next calls" stm:"next"`
		CursorOperationRestarted          int `bson:"cursor operation restarted" stm:"restarted"`
		CursorPrevCalls                   int `bson:"cursor prev calls" stm:"prev"`
		CursorRemoveCalls                 int `bson:"cursor remove calls" stm:"remove"`
		CursorReserveCalls                int `bson:"cursor reserve calls" stm:"reserve"`
		CursorResetCalls                  int `bson:"cursor reset calls" stm:"reset"`
		CursorSearchCalls                 int `bson:"cursor search calls" stm:"search"`
		CursorSearchHistoryStoreCalls     int `bson:"cursor search history store calls" stm:"search_history"`
		CursorSearchNearCalls             int `bson:"cursor search near calls" stm:"search_near"`
		CursorSweepBuckets                int `bson:"cursor sweep buckets" stm:"sweep_buckets"`
		CursorSweepCursorsClosed          int `bson:"cursor sweep cursors closed" stm:"sweep_cursors"`
		CursorSweepCursorsExamined        int `bson:"cursor sweep cursors examined" stm:"sweep_examined"`
		CursorSweeps                      int `bson:"cursor sweeps" stm:"sweeps"`
		CursorTruncateCalls               int `bson:"cursor truncate calls" stm:"truncate"`
		CursorUpdateCalls                 int `bson:"cursor update calls" stm:"update"`
		CursorUpdateValueSizeChange       int `bson:"cursor update value size change" stm:"update_value"`
	} `bson:"cursor" stm:"cursor"`
	Lock *struct {
		CheckpointLockAcquisitions                 int `bson:"checkpoint lock acquisitions" stm:"checkpoint_acquisitions"`
		DhandleReadLockAcquisitions                int `bson:"dhandle read lock acquisitions" stm:"read_acquisitions"`
		DhandleWriteLockAcquisitions               int `bson:"dhandle write lock acquisitions" stm:"write_acquisitions"`
		DurableTimestampQueueReadLockAcquisitions  int `bson:"durable timestamp queue read lock acquisitions" stm:"durable_timestamp_queue_read_acquisitions"`
		DurableTimestampQueueWriteLockAcquisitions int `bson:"durable timestamp queue write lock acquisitions" stm:"durable_timestamp_queue_write_acquisitions"`
		MetadataLockAcquisitions                   int `bson:"metadata lock acquisitions" stm:"metadata_acquisitions"`
		ReadTimestampQueueReadLockAcquisitions     int `bson:"read timestamp queue read lock acquisitions" stm:"read_timestamp_queue_read_acquisitions"`
		ReadTimestampQueueWriteLockAcquisitions    int `bson:"read timestamp queue write lock acquisitions" stm:"read_timestamp_queue_write_acquisitions"`
		SchemaLockAcquisitions                     int `bson:"schema lock acquisitions" stm:"schema_acquisitions"`
		TableReadLockAcquisitions                  int `bson:"table read lock acquisitions" stm:"table_read_acquisitions"`
		TableWriteLockAcquisitions                 int `bson:"table write lock acquisitions" stm:"table_write_acquisitions"`
		TxnGlobalReadLockAcquisitions              int `bson:"txn global read lock acquisitions" stm:"txn_global_read_acquisitions"`

		CheckpointLockApplicationThreadWaitTimeUsecs               int `bson:"checkpoint lock application thread wait time (usecs)" stm:"checkpoint_wait_time"`
		CheckpointLockInternalThreadWaitTimeUsecs                  int `bson:"checkpoint lock internal thread wait time (usecs)" stm:"checkpoint_internal_thread_wait_time"`
		DhandleLockApplicationThreadTimeWaitingUsecs               int `bson:"dhandle lock application thread time waiting (usecs)" stm:"application_thread_time_waiting"`
		DhandleLockInternalThreadTimeWaitingUsecs                  int `bson:"dhandle lock internal thread time waiting (usecs)" stm:"internal_thread_time_waiting"`
		DurableTimestampQueueLockApplicationThreadTimeWaitingUsecs int `` /* 137-byte string literal not displayed */
		DurableTimestampQueueLockInternalThreadTimeWaitingUsecs    int `` /* 131-byte string literal not displayed */
		MetadataLockApplicationThreadWaitTimeUsecs                 int `bson:"metadata lock application thread wait time (usecs)" stm:"metadata_application_thread_wait_time"`
		MetadataLockInternalThreadWaitTimeUsecs                    int `bson:"metadata lock internal thread wait time (usecs)" stm:"metadata_internal_thread_wait_time"`
		ReadTimestampQueueLockApplicationThreadTimeWaitingUsecs    int `` /* 131-byte string literal not displayed */
		ReadTimestampQueueLockInternalThreadTimeWaitingUsecs       int `bson:"read timestamp queue lock internal thread time waiting (usecs)" stm:"read_timestamp_queue_internal_thread_time_waiting"`
		SchemaLockApplicationThreadWaitTimeUsecs                   int `bson:"schema lock application thread wait time (usecs)" stm:"schema_application_thread_wait_time"`
		SchemaLockInternalThreadWaitTimeUsecs                      int `bson:"schema lock internal thread wait time (usecs)" stm:"schema_internal_thread_wait_time"`
	} `bson:"lock" stm:"lock"`
	Log *struct {
		LogFlushOperations             int `bson:"log flush operations" stm:"flush"`
		LogForceWriteOperations        int `bson:"log force write operations" stm:"force_write"`
		LogForceWriteOperationsSkipped int `bson:"log force write operations skipped" stm:"write_skip"`
		LogScanOperations              int `bson:"log scan operations" stm:"scan"`
		LogSyncOperations              int `bson:"log sync operations" stm:"sync"`
		LogSyncDirOperations           int `bson:"log sync_dir operations" stm:"sync_dir"`
		LogWriteOperations             int `bson:"log write operations" stm:"write"`

		LogBytesOfPayloadData    int `bson:"log bytes of payload data" stm:"payload"`
		LogBytesWritten          int `bson:"log bytes written" stm:"written"`
		LoggingBytesConsolidated int `bson:"logging bytes consolidated" stm:"consolidated"`
		TotalLogBufferSize       int `bson:"total log buffer size" stm:"buffer_size"`
	} `bson:"log" stm:"log"`
	Transaction *struct {
		PreparedTransactions   int `bson:"prepared transactions" stm:"prepare"`
		QueryTimestampCalls    int `bson:"query timestamp calls" stm:"query"`
		RollbackToStableCalls  int `bson:"rollback to stable calls" stm:"rollback"`
		SetTimestampCalls      int `bson:"set timestamp calls" stm:"set_timestamp"`
		TransactionBegins      int `bson:"transaction begins" stm:"begin"`
		TransactionSyncCalls   int `bson:"transaction sync calls" stm:"sync"`
		TransactionsCommitted  int `bson:"transactions committed" stm:"committed"`
		TransactionsRolledBack int `bson:"transactions rolled back" stm:"rolled_back"`
	} `bson:"transaction" stm:"transaction"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL