Skip to main content
Version: NG-2.16

MongoDB

Introduction​

MongoDB is a popular NoSQL database program. It is known for being scalable, flexible, and efficient in handling unstructured data. When people refer to a "Mongo cluster," they are usually talking about a MongoDB Cluster, which is a set of MongoDB servers that work together to provide high availability, fault tolerance, and scalability.

Getting Started​

Compatibility​

The MongoDB O11ySource is compatible with all versions of MongoDB equal to or greater than 5.0.26.

Data Collection Method​

vuSmartMaps collects health and performance data for MongoDB O11ySource using an internal data collector. This agent collects data based on the source configuration.

Prerequisites​

Dependent Configuration​

To configure this O11ySource, create a 'credential' of type user and tls_certificate_bundle under the 'Definition' tab.

Inputs for Configuring Data Source​

  • Host: The IP Address/FQDN of the MongoDB host. This field is the key to identify each server you add here.
  • Port: Enter a valid port
  • Credential: This field is required
  • TLS: Enable TLS for the MongoDB connection.
  • TLS Mode: Select the TLS credential material required by the MongoDB connection.
  • Skip Certificate Verification: Skip TLS server certificate and hostname verification for the MongoDB connection.
  • TLS Credential: Select the TLS certificate bundle credential to use for this MongoDB connection.
  • Polling Frequency: Specifies the interval in seconds at which data is collected. Data collection occurs once every specified period.

Firewall Requirement​

To collect data from this O11ySource, ensure the following ports are opened:

Source IPDestination IPDestination PortProtocolDirection
vuSmartMaps IPIP of MongoDB Server27017*TCPOutbound

*Before providing the firewall requirements, please update the port based on the customer environment.

Configuring the Target​

Configuring Metrics Collection from MongoDB Server

Metrics from MongoDB are gathered by establishing a connection to the server using a user with appropriate permissions. To get started with the standard MongoDB integration, create a read-only user with the necessary privileges to access performance metrics and other monitoring data.

Steps to Configure MongoDB Monitoring User: Connect to the MongoDB Instance: Use the mongo shell or a MongoDB client to connect to your MongoDB server with a user that has the appropriate administrative privileges.

mongo --host <HOST> --port <PORT> -u <ADMIN_USER> -p <ADMIN_PASSWORD> --authenticationDatabase admin

Create a Monitoring User: Execute the following commands to create a read-only monitoring user and assign the required roles (use admin) Create a new user with monitoring roles

db.createUser({
user: "vunet",
pwd: "<PASSWORD>",
roles: [
{ role: "read", db: "admin" }, // Read access to the admin database
{ role: "clusterMonitor", db: "admin" }, // Access to cluster statistics
{ role: "readAnyDatabase", db: "admin" }, // Read access to all databases
{ role: "dbAdmin", db: "admin" } // Access to database administration statistics
]
});

Verify Access for the 'vunet' User: Use the vunet user credentials to confirm connectivity and validate permissions.

mongo --host <HOST> --port <PORT> -u vunet -p <PASSWORD> --authenticationDatabase admin

Run sample queries to ensure the user can access necessary collections for metrics:

  • Check replication status
db.runCommand({ replSetGetStatus: 1 });
  • Retrieve server status
db.serverStatus();
  • Check current operations
db.currentOp();
  • Access collection statistics
db.stats();

Enable Access to Specific Collections (Optional): If additional collections or databases are required for monitoring, grant the vunet user specific privileges on those collections:

use <DATABASE_NAME>;
db.grantRolesToUser("vunet", [
{ role: "read", db: "<DATABASE_NAME>" },
{ role: "dbAdmin", db: "<DATABASE_NAME>" }
]);

Verify Metrics Collection: Ensure the monitoring tool can successfully fetch metrics using the vunet user's credentials.

By following these steps, you can configure a monitoring user in MongoDB for effective metrics collection, ensuring secure and granular access to the database.

Configuration Steps​

  • Enable the MongoDB O11ySource.
  • Select the Sources tab and press the + button to add a new MongoDB instance to be monitored.
  • Add the required details and then click on then click Finish to close the data source window.

Metrics Collected​

NameDescriptionData Type
collectionName of the collectionString
commands_countTotal commands executedUInt64
commands_timeTime taken for commandsUInt64
db_nameDatabase nameString
get_more_countTotal get more requestsUInt64
get_more_timeTime taken for get more requestsUInt64
hostHost nameString
hostnameHost addressString
insert_countTotal insert operationsUInt64
insert_timeTime taken for insert operationsUInt64
nameStatistics nameString
node_typeNode typeString
queries_countTotal queries executedUInt64
queries_timeTime taken for queriesUInt64
read_lock_countTotal read locks acquiredUInt64
read_lock_timeTime taken for read locksUInt64
remove_countTotal remove operationsUInt64
remove_timeTime taken for remove operationsUInt64
rs_nameReplica set nameString
timestampTime when the stats were recordedDateTime64
total_countTotal operations countedUInt64
total_timeTotal time for operationsUInt64
typeType of statsString
update_countTotal update operationsUInt64
update_timeTime taken for update operationsUInt64
write_lock_countTotal write locks acquiredUInt64
write_lock_timeTime taken for write locksUInt64
tenant_idTenant IDString
bu_idBusiness unit IDUInt64
targetTarget server addressString
@timestampTimestamp when the stats were recordedString
avg_obj_sizeAverage object sizeUInt64
collectionName of the collectionString
countTotal countUInt64
db_nameDatabase nameString
hostHost nameString
hostnameHost addressString
nameStatistics nameString
node_typeNode typeString
okStatus of the operationUInt8
rs_nameReplica set nameString
sizeCollection sizeUInt64
storage_sizeStorage size of the collectionUInt64
timestampTime when the stats were recordedDateTime64
total_index_sizeTotal index size of the collectionUInt64
typeType of statsString
tenant_idTenant IDUInt64
bu_idBusiness unit IDUInt64
targetTarget server addressString
@timestampTimestamp when the stats were recordedString
avg_obj_sizeAverage object size in the databaseFloat64
collectionsTotal collections in the databaseUInt64
data_sizeTotal data size in the databaseUInt64
db_nameDatabase nameString
fs_total_sizeTotal file system size availableUInt64
fs_used_sizeFile system size usedUInt64
hostHost nameString
hostnameHost addressString
index_sizeTotal index size in the databaseUInt64
indexesNumber of indexes in the databaseUInt64
nameStatistics nameString
node_typeNode typeString
num_extentsNumber of extentsUInt64
objectsTotal number of objects in the databaseUInt64
okStatus of the operationUInt8
rs_nameReplica set nameString
storage_sizeStorage size of the databaseUInt64
timestampTime when the stats were recordedDateTime64
typeType of statsString
tenant_idTenant IDUInt64
bu_idBusiness unit IDUInt64
targetTarget server addressString
@timestampTimestamp when the stats were recordedString
availableAvailability statusUInt8
collectionName of the collectionString
createdTotal createdUInt64
db_nameDatabase nameString
hostHost nameString
hostnameHost addressString
in_useCurrently in useUInt8
nameStatistics nameString
node_typeNode typeString
refreshingRefreshing statusUInt8
rs_nameReplica set nameString
timestampTime when the stats were recordedDateTime64
typeType of statsString
tenant_idTenant IDUInt64
bu_idBusiness unit IDUInt64
targetTarget server addressString
@timestampTimestamp when the stats were recordedString
active_readsNumber of active readsUInt64
active_writesNumber of active writesUInt64
aggregate_command_failedFailed aggregate commandsUInt64
aggregate_command_totalTotal aggregate commandsUInt64
assert_msgAssert message countUInt64
assert_regularAssert regular countUInt64
assert_rolloversAssert rolloversUInt64
assert_userAssert user countUInt64
assert_warningAssert warning countUInt64
available_readsAvailable read ticketsUInt64
available_writesAvailable write ticketsUInt64
commandsTotal commands executedUInt64
commands_per_secCommands executed per secondUInt32
connections_availableNumber of available connectionsUInt32
connections_currentCurrent number of connectionsUInt32
open_connectionsTotal open connectionsUInt32
connections_total_createdTotal connections createdUInt64
count_command_failedFailed count commandUInt64
count_command_totalTotal count commandUInt64
cursor_no_timeoutCursor no timeout flagUInt64
cursor_no_timeout_countCount of cursor no timeoutUInt64
cursor_pinnedCursor pinned flagUInt64
cursor_pinned_countCount of pinned cursorsUInt64
cursor_timed_outCursor timed out flagUInt64
cursor_timed_out_countCount of cursor timeoutsUInt64
cursor_totalTotal cursor countUInt64
cursor_total_countTotal cursor count valueUInt64
delete_command_failedDelete command failedUInt64
delete_command_totalTotal delete commandsUInt64
deletesTotal deletesUInt64
deletes_per_secDeletes per secondUInt32
distinct_command_failedFailed distinct commandUInt64
distinct_command_totalTotal distinct commandsUInt64
document_deletedTotal documents deletedUInt64
document_insertedTotal documents insertedUInt64
document_returnedTotal documents returnedUInt64
document_updatedTotal document updatesUInt64
find_and_modify_command_failedFind and modify command failedUInt64
find_and_modify_command_totalTotal find and modify commandsUInt64
find_command_failedFind command failedUInt64
find_command_totalTotal find commandsUInt64
flushesTotal flushesUInt64
flushes_per_secFlushes per secondUInt64
flushes_total_time_nsTotal time for flushesUInt64
get_more_command_failedGet more command failedUInt64
get_more_command_totalTotal get more commandsUInt64
getmoresTotal get more operationsUInt64
getmores_per_secGet more operations per secondUInt64
hostHost machineString
hostnameHostnameString
insert_command_failedFailed insert commandUInt64
insert_command_totalTotal insert commandsUInt32
insertsTotal insertsUInt64
inserts_per_secInserts per secondUInt64
jumbo_chunksTotal jumbo chunksUInt64
latency_commandsCommand latencyUInt64
latency_commands_countCommand latency countUInt64
latency_readsRead latencyUInt64
latency_reads_countRead latency countUInt64
latency_writesWrite latencyUInt64
latency_writes_countWrite latency countUInt64
member_statusMember status of nodeString
nameStatistics nameString
timestampTime when the stats were recordedDateTime64
typeType of statsString
tenant_idTenant IDUInt64
bu_idBusiness unit IDUInt64
targetTarget server addressString
@timestampTimestamp when the stats were recordedString
uptime_nsUptime of the MongoDB server in nanosecondsUInt64
rs_nameReplica set nameString
net_in_bytesTotal network input in bytesUInt64
net_out_bytesTotal network output in bytesUInt64
net_in_bytes_countCount of network input bytesUInt64
net_out_bytes_countCount of network output bytesUInt64
locks_Collection_DeadLockCount_ReadNumber of times a collection shared lock request encountered a deadlockUInt64
locks_Collection_DeadLockCount_ReadLowerNumber of times a collection exclusive lock request encountered a deadlockUInt64
locks_Collection_DeadLockCount_WriteNumber of times a collection intent shared lock request encountered a deadlockUInt64
locks_Collection_DeadLockCount_WriteLowerNumber of times a collection intent exclusive lock request encountered a deadlockUInt64
locks_Collection_AcquireWaitCount_ReadNumber of times a collection shared lock was waited forUInt64
locks_Collection_AcquireWaitCount_ReadLowerNumber of times a collection exclusive lock was waited forUInt64
locks_Collection_AcquireWaitCount_WriteNumber of times a collection intent shared lock was waited forUInt64
locks_Collection_AcquireWaitCount_WriteLowerNumber of times a collection intent exclusive lock was waited forUInt64
locks_Collection_AcquireCount_ReadNumber of times a shared collection shared lock was acquiredUInt64
locks_Collection_AcquireCount_ReadLowerNumber of times a collection exclusive lock was acquiredUInt64
locks_Collection_AcquireCount_WriteNumber of times a collection intent shared lock was acquiredUInt64
locks_Collection_AcquireCount_WriteLowerNumber of times a collection intent exclusive lock was acquiredUInt64
locks_Global_AcquireWaitCount_ReadNumber of times a global shared lock was waited forUInt64
locks_Global_AcquireWaitCount_ReadLowerNumber of times a global shared lock was waited forUInt64
locks_Global_AcquireWaitCount_WriteNumber of times a global exclusive lock was waited forUInt64
locks_Global_AcquireWaitCount_WriteLowerNumber of times a global exclusive lock was waited forUInt64
locks_Global_DeadLockCount_ReadNumber of times a global shared lock request encountered a deadlockUInt64
locks_Global_DeadLockCount_ReadLowerNumber of times a global exclusive lock request encountered a deadlockUInt64
locks_Global_DeadLockCount_WriteNumber of times a global intent shared lock request encountered a deadlockUInt64
locks_Global_DeadLockCount_WriteLowerNumber of times a global intent exclusive lock request encountered a deadlockUInt64
locks_Global_AcquireCount_ReadNumber of times a global shared lock was acquiredUInt64
locks_Global_AcquireCount_ReadLowerNumber of times a global shared lock was acquiredUInt64
locks_Global_AcquireCount_WriteNumber of times a global exclusive lock was acquiredUInt64
locks_Global_AcquireCount_WriteLowerNumber of times a global exclusive lock was acquiredUInt64
locks_Database_AcquireWaitCount_ReadNumber of times a database shared lock was waited forUInt64
locks_Database_AcquireWaitCount_ReadLowerNumber of times a database exclusive lock was waited forUInt64
locks_Database_AcquireWaitCount_WriteNumber of times a database intent shared lock was waited forUInt64
locks_Database_AcquireWaitCount_WriteLowerNumber of times a database intent exclusive lock was waited forUInt64
locks_Database_AcquireCount_ReadNumber of times a database shared lock was acquiredUInt64
locks_Database_AcquireCount_ReadLowerNumber of times a database exclusive lock was acquiredUInt64
locks_Database_AcquireCount_WriteNumber of times a database intent shared lock was acquiredUInt64
locks_Database_AcquireCount_WriteLowerNumber of times a database intent exclusive lock was acquiredUInt64
locks_Database_DeadLockCount_ReadNumber of times a database shared lock request encountered a deadlockUInt64
locks_Database_DeadLockCount_ReadLowerNumber of times a database exclusive lock request encountered a deadlockUInt64
locks_Database_DeadLockCount_WriteNumber of times a database intent shared lock request encountered a deadlockUInt64
locks_Database_DeadLockCount_WriteLowerNumber of times a database intent exclusive lock request encountered a deadlockUInt64
resident_megabytesAmount of memory in megabytes that is currently in RAMUInt64
vsize_megabytesAmount of memory in megabytes that is currently in Virtual memoryUInt64
members_down_countCount of down members in the replication setUInt64
oplog_size_allocatedAllocated size of the oplog in bytesUInt64
oplog_size_usedUsed size of the oplog in bytesUInt64
members_unhealthy_countCount of unhealthy members in the replication setUInt64
optimes_Applied_TS_TTimestamp of the last oplog entry appliedUInt64
optimes_Durable_TS_TTimestamp of the last oplog entry durableUInt64
optimes_LastCommitted_TS_TTimestamp of the last oplog entry committedUInt64
members_headroom_maxMaximum headroom (remaining oplog time) in millisecondsUInt64
members_headroom_minMinimum headroom (remaining oplog time) in millisecondsUInt64
members_lag_maxMaximum replication lag in millisecondsInt64
members_lag_minMinimum replication lag in millisecondsInt64
members_primary_hostsHostname of the primary member in the replication setString
members_secondry_hostsHostnames of the secondary members in the replication setArray(String)
members_recovering_hostsHostnames of the recovering members in the replication setArray(String)
members_unknown_hostsHostnames of the unknown members in the replication setArray(String)
members_startup2_hostsHostnames of the startup2 members in the replication setArray(String)
members_arbiter_hostsHostnames of the arbiter members in the replication setArray(String)
members_down_hostsHostnames of the down members in the replication setArray(String)
members_rollback_hostsHostnames of the rollback members in the replication setArray(String)
members_unhealthy_hostsHostnames of the unhealthy members in the replication setArray(String)
ttl_deletesNumber of documents deleted by the TTL monitorUInt32
ttl_deletes_per_secRequest rate per SecondFloat32
ttl_passesNumber of times the TTL monitor completed a passUInt32
ttl_passes_per_secRequest rate per SecondFloat32
repl_oplog_window_secSize of the oplog window in secondsUInt64
page_faultsNumber of page faultsUInt64