Supported Target Versions
Validated on MongoDB version 6.0.10

Application Version Details

Application VersionBug fixes / Enhancements
2.0.1Support for multiple MongodB instances running on same node.
2.0.0Persona changes to support Cluster and Standalone MongoDB configurations.
1.0.0Initial version with discovery, monitoring, alerts.

Introduction

MongoDB is a NoSQL database management application. NoSQL database systems offer an alternative to traditional relational databases using SQL (Structured Query Language). Data is stored in tables, rows, and columns in a relational database, with relationships between entities. MongoDB is a widely used, open-source, NoSQL (Not Only SQL) database. Here are some key points about MongoDB:

  • Document-Oriented Database
  • Flexible Schema
  • Scalability
  • High Performance
  • Aggregation Framework
  • Replication and High Availability

Key Use cases

Discovery Use cases

  • It discovers the MongoDB cluster and its component nodes.
  • Publishes relationships between resources to have a topological view and ease of maintenance.

Monitoring Use cases

  • Provides metrics related to job scheduling time and status etc..
  • Concern alerts will be generated for each metric to notify the administrator regarding the issue with the resource.

Prerequisites

  • OpsRamp Classic Gateway 14.0.0 and above.

  • OpsRamp Nextgen Gateway 14.0.0 and above.
    Note: OpsRamp recommends using the latest Gateway version for full coverage of recent bug fixes, enhancements, etc..

  • Provided IPAddress/hostname, Credentials (SSH and MongoDB database) should work for accessing MongoDB clusters.

  • The SSH credentials should be same for all the MongoDB replica set cluster nodes.

  • The MongoDB credentials should be the same for all the MongoDB replica set node instances.

  • We are using macAddress as a uniqueId for resource creation. To fetch the MAC Address we are using the ip addr show command. So we need ip command path in PATH environment variable, please add below mentioned lines in .profile or .bashrc file in all the MongoDB servers ( User should have a home directory then only .bash_profile or .bashrc file will be present).

    PATH={ipPath}:$PATH
    export PATH

    Notes:

    • Where ipPath is path where ip command binary is present. for example: if ip command is present in “/usr/sbin”, then provide PATH=/usr/sbin:$PATH
    • As we are utilizing a remote SSH connection, if the environment PATH does not include the binary path for the command, you may encounter a ‘command not found’ exception.
  • As part of discovery we are fetching the serial number and system UUID of the individual nodes. These details are fetched through command-line(SSH).

    • If the SSH credentials being provided are “root” users, no changes need to be made.
    • If the SSH credentials being provided are of a “non-sudo” user, then we need to make an entry in the /etc/sudoers file as below:
Dell PowerFlex
  • With the above entry, we will be able to execute that sudo command.

  • For connecting to the mongoDB instance, a user with “readAnyDatabase” and “clusterMonitor” role on the “admin” database will suffice. In case of replica set clusters the same user credential is expected to be available on all the nodes.

    For example we have created the user as below:

Dell PowerFlex
  • We are using both SSH credentials (for ssh/cli access) and mongoDB instance credentials(for mongoDB instance connection). You may connect to the mongoDB instance using a connection string.

  • MongoDB hosts should be resolvable from the gateway.

    • If you are using the NextGen gateway and the hosts are not resolving from the gateway and vprobe container.

      See How to manually add DNS Name Servers to k3s? to manually add DNS name servers to k3s

    • If you are using the classic gateway, please add a DNS server entry in the resolv.conf file or mention hosts in the /etc/hosts file.

Hierarchy of MongoDB resources

For a replica set cluster:

    • MongoDB Replica Set
             • MongoDB Server

For a standalone MongoDB instance:

    • MongoDB Server

You may take the node ip, either standalone or one replica set node (in case of replica set cluster) and the concerned port as input as part of configuration. You would require ssh credentials for the mongoDB server and mongoDB instance credentials as well for executing the remote SSH/ CLI commands.

Supported Metrics

Click here to view the supported metrics
Native TypeMetric NameDisplay NameMetric LabelUnitsApplication VersionDescription
MongoDB Replica Setmongodb_cluster_FailoverStatusMongoDB Cluster Failover StatusAvailabilityNone1.0.0Metric represents if failover happened in the replica set cluster. Possible values are : NoFailover - 0, FailoverHappened - 1
mongodb_cluster_TotalNodesMongoDB Cluster Total NodesAvailabilitycount1.0.0Total number of MongoDB instances in the replica set cluster
mongodb_cluster_ActiveClientsMongoDB Cluster Active ClientsUsagecount1.0.0Total number of active client connections to the database.
mongodb_cluster_ActiveReadClientsMongoDB Cluster Active Read ClientsUsagecount1.0.0Count of the active client connections performing read operations.
mongodb_cluster_ActiveWriteClientsMongoDB Cluster Active Write ClientsUsagecount1.0.0Count of active client connections performing write operations.
mongodb_cluster_CurrentQueueMongoDB Cluster Current QueuePerformancecount1.0.0Current Queue.
mongodb_cluster_CurrentQueueReadersMongoDB Cluster Current Queue ReadersPerformancecount1.0.0Current readers in Queue.
mongodb_cluster_CurrentQueueWritersMongoDB Cluster Current Queue WritersPerformancecount1.0.0Current writers in Queue.
MongoDB Servermongodb_server_ReplicationStateMongoDB Server Replication StateAvailabilityNone1.0.0MongoDB server replication state. Possible values are :PRIMARY :0 ,SECONDARY :1,DOWN :2,RECOVERING :3,STARTUP :4,STARTUP2 :5,FATAL :6,UNKNOWN :7
Note: This metric is not supported in MongoDB standalone server.
mongodb_server_UptimeMongoDB Server UptimeAvailabilitym1.0.0MongoDB server Uptime in minutes.
mongodb_server_MessageAssertsMongoDB Server Message AssertsUsagecount1.0.0The number of messages asserts. These are typically used for logging and informational purposes.
mongodb_server_RegularAssertsMongoDB Server Regular AssertsUsagecount1.0.0The number of regular asserts, which typically involve checks on data integrity and validation.
mongodb_server_RolloverAssertsMongoDB Server Rollover AssertsUsagecount1.0.0The number of times the assert counters have rolled over. When the maximum value for an assert counter is reached, it rolls over to zero.
mongodb_server_TotalAssertsMongoDB Server Total AssertsUsagecount1.0.0An aggregate count of all assertion checks, and it can provide insights into the overall health and reliability of your MongoDB server.
mongodb_server_UserAssertsMongoDB Server User AssertsUsagecount1.0.0The number of users asserts, which can be raised by user-defined functions in MongoDB, such as those in JavaScript stored procedures.
mongodb_server_WarningAssertsMongoDB Server Warning AssertsUsagecount1.0.0The number of warning asserts. These are non-fatal issues that MongoDB has detected but does not necessarily indicate data corruption.
mongodb_server_AvailableConnectionsMongoDB Server Available ConnectionsUsagecount1.0.0The number of unused, available connections that can be used by clients to connect to the server. It represents the pool of connections available for new client connections.
mongodb_server_CurrentConnectionsMongoDB Server Current ConnectionsUsagecount1.0.0The number of active connections to the MongoDB server. This represents the total number of currently open connections.
mongodb_server_cachedCursorsMongoDB Server Cached CursorsPerformancecount1.0.0The number of cursors currently cached in memory. Cursor caching is used to optimize query performance.
mongodb_server_OpenCursorsMongoDB Server Open CursorsPerformancecount1.0.0The current count of open cursors.
mongodb_server_CursorsTimeoutMongoDB Server Cursors TimeoutPerformancecount1.0.0The number of cursors that have timed out and been closed due to inactivity. This metric provides insights into cursor efficiency and system resource management.
mongodb_server_HeapUsageMongoDB Server Heap UsageUsageBytes1.0.0MongoDB server heap usage.
mongodb_server_MemoryMongoDB Server MemoryUsageBytes1.0.0The amount of memory used by the mongoDB server.
mongodb_server_ResidentMemoryMongoDB Server Resident MemoryUsageBytes1.0.0The amount of memory (in bytes) currently used by the MongoDB server process for data, indexes, and other memory-mapped files that are in physical RAM.
mongodb_server_VirtualMemoryMongoDB Server Virtual MemoryUsageBytes1.0.0The virtual memory size (in bytes) of the MongoDB server process.
mongodb_server_NetworkRequestsMongoDB Server Network RequestsUsagecount1.0.0The cumulative count of client requests that have been processed by the MongoDB server since it was last started.
mongodb_server_OpCountersMongoDB Server Op CountersUsagecount1.0.0OpCounters for a mongodb server.
mongodb_server_OpCountersCommandMongoDB Server Opcounters commandUsagecount1.0.0The total number of commands executed.
mongodb_server_OpCountersDeleteMongoDB Server Opcounters DeleteUsagecount1.0.0The total number of delete operations executed.
mongodb_server_OpCountersGetMongoDB Server Opcounters GetUsagecount1.0.0The total number of "get more" operations.
mongodb_server_OpCountersInsertMongoDB Server Opcounters InsertUsagecount1.0.0The total number of insert operations performed.
mongodb_server_OpCountersQueryMongoDB Server Opcounters QueryUsagecount1.0.0The total number of query operations executed
mongodb_server_OpCountersUpdateMongoDB Server Opcounters UpdateUsagecount1.0.0The total number of update operations performed.
mongodb_server_PageFaultsMongoDB Server Page FaultsPerformancecount1.0.0The number of page faults that have occurred on the MongoDB server.
mongodb_server_network_BytesInMongoDB Server Netwotk Bytes InPerformanceBytes1.0.0The total number of bytes received by the MongoDB server over the network since the server was last started.
mongodb_server_network_BytesOutMongoDB Server Network Bytes OutPerformanceBytes1.0.0The total number of bytes sent by the MongoDB server over the network since the server was last started.
mongodb_server_network_PhysicalBytesInMongoDB Server Network Physical Bytes InPerformanceBytes1.0.0The physical network traffic that is received at network interface level.
mongodb_server_network_PhysicalBytesOutMongoDB Server Network Physical Bytes OutPerformanceBytes1.0.0The physical network traffic that is sent at network interface level
mongodb_server_NumRequestsMongoDB Server Number of RequestsPerformancecount1.0.0The total number of client requests received by the MongoDB server since it started.
mongodb_server_IndexSizeMongoDB Server Index SizeUsageBytes1.0.0The total size of all indexes on collections in the database, in bytes.
mongodb_server_SizeMongoDB Server Database SizeUsageBytes1.0.0The total size that has been allocated for the database.

Default Monitoring Configurations

MongoDB has default Global Device Management Policies, Global Templates, Global Monitors and Global Metrics in OpsRamp. You can customize these default monitoring configurations as per your business use cases by cloning respective Global Templates and Global Device Management Policies. We recommend doing this activity before installing the application to avoid noise alerts and data.

  1. Default Global Device Management Policies

    You can find the Device Management Policy for each Native Type at Setup > Resources > Device Management Policies. Search with suggested name in global scope. Each Device Management Policy follows below naming convention:

    {appName nativeType - version - Mode}

    Ex: mongodb MongoDB Replica Set - 1 - Cluster(i.e, appName = mongodb, nativeType = MongoDB Replica Set , version = 1, , Mode = Cluster)

  2. Default Global Templates

    You can find the Global Templates for each Native Type at Setup > Monitoring > Templates. Search with suggested names in global scope. Each template follows below naming convention:

    {appName Mode nativeType 'Template' - version}

    Ex: mongodb Cluster MongoDB Replica Set Template- 1(i.e, appName = mongodb, Mode = Cluster, nativeType = MongoDB Replica Set, version = 1)

  3. Default Global Monitors

    You can find the Global Monitors for each Native Type at Setup > Monitoring > Monitors. Search with suggested name in global scope. Each Monitors follows below naming convention:

    {monitorKey appName nativeType - version}

    Ex: MongoDB Replica Set Cluster Monitor mongodb MongoDB Replica Set 1 (i.e, monitorKey =MongoDB Replica Set Cluster Monitor, appName = mongodb, nativeType = MongoDB Replica Set , version = 2)

Configure and Install the MongoDB Integration

  1. From All Clients, select a client.
  2. Navigate to Setup > Account.
  3. Select the Integrations tab.
  4. The Installed Integrations page, where all the installed integrations are displayed. Click + ADD on the Installed Integrations page.
  5. If you do not have any installed applications, you will be navigated to the Available Integrations page. The Available Integrations page displays all the available applications along with the newly created application with the version.
    Note: Search for the application using the search option available. Alternatively, use the All Categories option to search.
  6. Click ADD in the MongoDB tile.
  7. In the Configurations page, click + ADD. The Add Configuration page appears.
  8. Enter the following BASIC INFORMATION:
FunctionalityDescription
NameEnter the name for the configuration.
ModeSelect Cluster or Standalone based on the mongodb configuration:
  • Cluster if selected MongoDB is a cluster
  • Standalone if selected MongoDB is a standalone server
  • Note:
  • For a MongoDB cluster, If Standalone Mode is selected part of configuration, only MongoDB Server will get created/updated. MongoDB Replica Set wont be discovered and will get deleted if already exists.
IP Address/Host Name of MongoDB ServerIP Address/Hostname of the target.
SSH PortSSH Port
Note: By default 22 is the port value
SSH CredentialsSelect the SSH credentials from the drop-down list.
Note: Click + Add to create a credential.
MongoDB PortMongoDB Port
Note: By default 27017 is the prot value.
MongoDB Instance CredentialsSelect the MongoDB Instance Credentials from the drop-down list.
Note: Click + Add to create a credential.

Notes:

  • IP Address/Host Name should be accessible from Gateway.
  • App Failure Notifications: if turned on, you will be notified in case of an application failure that is, Connectivity Exception, Authentication Exception.
  1. Select the following Custom Attribute:
Field NameDescription
Custom AttributeSelect the custom attribute from the drop down list box.
ValueSelect the value from the drop down list box.

Note: The custom attribute that you add here will be assigned to all the resources that are created by the integration. You can add a maximum of five custom attributes (key and value pair).

  1. In the RESOURCE TYPE section, select:
    • ALL: All the existing and future resources will be discovered.
    • SELECT: You can select one or multiple resources to be discovered.
  2. In the DISCOVERY SCHEDULE section, select recurrence pattern to add one of the following patterns:
    • Minutes
    • Hourly
    • Daily
    • Weekly
    • Monthly
  3. Click ADD.
Dell PowerFlex

Now the configuration is saved and displayed on the configurations page after you save it.
Note: From the same page, you may Edit and Remove the created configuration.

  1. Under the ADVANCED SETTINGS, Select the Bypass Resource Reconciliation option, if you wish to bypass resource reconciliation when encountering the same resources discovered by multiple applications.

    Note: If two different applications provide identical discovery attributes, two separate resources will be generated with those respective attributes from the individual discoveries.

  2. Click NEXT.

  3. (Optional) Click +ADD to create a new collector. You can either use the pre-populated name or give the name to your collector.

  4. Select an existing registered profile.

  1. Click FINISH.

The integration is installed and displayed on the INSTALLED INTEGRATION page. Use the search field to find the installed integration.

Modify the Configuration

View the MongoDB Details

To discover resources for MongoDB, you have two options:

  1. Navigate to Infrastructure > Search > DATABASES > MongoDB.
  2. The MONGODB page is displayed, select the application name.
  3. The RESOURCE DETAILS page appears from the right.
  4. Click the ellipsis () on the top right and select View details.
Dell PowerFlex
  1. Navigate to the Attributes tab to view the discovery details.
Dell PowerFlex
  • Click the Metrics tab to view the metric details for MongoDB.

View resource metrics

To confirm MongoDB monitoring, review the following:

  • Metric graphs: A graph is plotted for each metric that is enabled in the configuration.
  • Alerts: Alerts are generated for metrics that are configured as defined for integration.
Dell PowerFlex

Resource Filter Input keys

MongoDB application Resources are filtered and discovered based on below keys:

Click here to view the Supported Input Keys
Resource TypeSupported Input Keys
All TypesresourceName
hostName
aliasName
dnsName
ipAddress
macAddress
os
make
model
MongoDB ServerArbiter Node
Member Id
MongoDB Version

Supported Alert Custom Macros

Customize the alert subject and description with below macros then it will generate alert based on customisation.
Supported macros keys:

Click here to view the alert subject and description with macros

                                ${resource.name}

                                ${resource.ip}

                                ${resource.mac}

                                ${resource.type}

                                ${resource.make}

                                ${resource.model}

                                ${resource.serialnumber}

                                ${resource.systemId}

                                ${parent.resource.name}

                                            ${Custom attributes on the resource}

Risks, Limitations & Assumptions

  • The application can manage critical/recovery failure alerts for the following two scenarios when the user activates App Failure Notifications in the settings:
    • Connectivity Exception
    • Authentication Exception
  • MongoDB will send any duplicate/repeat failure alert notification for every 6 hours.
  • MongoDB cannot control monitoring pause/resume actions based on above alerts. Metrics can be used to monitor PowerMax resources and can generate alerts based on the threshold values.
  • We have provided 22 as default Port for SSH and 27017 as default Port for MongoDB. Users can modify this value from application configuration page at any point of time if requires.
  • Component level thresholds can be configured on each resource level.
  • No support of showing activity logs.
  • The Template Applied Time will only be displayed if the collector profile (Classic and NextGen Gateway) is version 18.1.0 or higher.
  • The minimum supported version for the option to get the latest snapshot metric is Nextgen-14.0.0.
  • MongoDB supports both Classic Gateway and NextGen Gateway.
  • MongoDB will work only if each Mongo DB instance is configured on different server.
  • For a MongoDB cluster, If Standalone Mode is selected part of configuration, only MongoDB Server will get created/updated. MongoDB Replica Set wont be discovered and will get deleted if already exists.

Troubleshooting

Before troubleshooting, ensure all prerequisites prerequisites are met.

If MongoDB integrations fail to discover or monitor, troubleshoot using the following steps:

  • Check if any alerts have been generation on MongoDB Replica Set/MongoDB Server, the gateway, or in vprobe.
  • If there is an error or alert related to the end device connectivity or authentication, try checking the reachability of the end device from the gateway with the following commands:
    • to ping the IP address provided in the configuration: {ping <IP Address>}
    • to try telnet: {telnet <IP Adress> <Port>}
    • to try ssh to the end device: {ssh <username>@<node IP Address>}
    • to try MongoDB connection to the end device: {mongosh --port <DB port> --host <IP Address> --username <username> --password <password>}
    • To run a SSH and MongoDB command:
      • Prepare the request payload by using below sample request:

        { “apiVersion”: “debug/v1”, “module”: “Debug”, “app”: “mongodb”, “action”: “Reachability”, “payload”: { “ipAddressOrHostName”: “”, “protocol”: “https”, “port”: 443, “requestPath”: “”,

        “version”:“v1”,

        “requestMethod”:"<get/post>", “userName”: “”, “password”: “” } }

      • Encode the request payload to base64

      • Log in to the gateway concole and connect to the GCLI terminal using the below command: {## gcli}

      • Run the command using the previously generated base64 encoded string {## sdkappdebug <base64 encoded string>}