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.

Supported Target Versions

  • Validated on MongoDB version 6.0.10

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.
  • Ensure that the provided IP address/host name, port, and credentials are valid and accessible for successful integration.
    • Verify network connectivity from the gateway using:
      ping <IP Address/Host Name>
    • Check port accessibility using:
      telnet <IP Address/Host Name> <Port>
    • Validate SSH access using the provided credentials:
      ssh -p <Port> <username>@<IP Address/Host Name>
  • 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.

For Linux Base OS

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).

<code>
    PATH={ipPath}:$PATH
</code><br>
<code>
    export PATH
</code><br><br>

**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.

  • 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, add a DNS server entry in the resolv.conf file or mention hosts in the /etc/hosts file.

For Windows Base OS

PowerShell Remoting over WinRM

Configuration steps

  • Enable PowerShell Remoting on every applicable target:
    Enable-PSRemoting -Force
  • Add the user to Remote Management Users:
    net localgroup "Remote Management Users" /add "<user>"
  • Add the OpsRamp Gateway IP to TrustedHosts:
    Set-Item WSMan:\localhost\Client\TrustedHosts -Force -Concatenate -Value "<OpsRampGatewayIP>"
  • To allow any host, when explicitly required:
    Set-Item WSMan:\localhost\Client\TrustedHosts -Force -Value "*"
  • Configure and restart WinRM:
    Set-Service WinRM -StartupType Automatic
    Restart-Service WinRM -Force
  • Open the applicable WinRM port on every target: 5985 for WinRM over HTTP or 5986 for WinRM over HTTPS.
  • If the user is a non-administrator, grant remote WMI read-only access to the Root\CIMV2 namespace and its subnamespaces. Ensure all required privileges are enabled before installing the integration.

OpenSSH Server

Pre-checks

Check whether OpenSSH Server is installed and check the SSH service:

Get-WindowsCapability -Online -Name OpenSSH.Server*
Get-Service sshd

Configuration steps

  • Install OpenSSH Server if it is not already installed:
    Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
  • Start sshd and configure automatic startup:
    Start-Service sshd
    Set-Service sshd -StartupType Automatic
  • Open inbound TCP port 22:
    New-NetFirewallRule `
            -Name "Allow-SSH-Port-22" `
            -DisplayName "Allow SSH Port 22" `
            -Protocol TCP `
            -Direction Inbound `
            -LocalPort 22 `
            -Action Allow `
            -Profile Domain,Private,Public
  • Open C:\ProgramData\ssh\sshd_config as an administrator:
    notepad C:\ProgramData\ssh\sshd_config
  • Configure password authentication and the permitted SSH user in sshd_config:
    PasswordAuthentication yes
    AllowUsers <ssh-username>
  • Set Windows PowerShell as the OpenSSH default shell:
    Set-ItemProperty `
            -Path "HKLM:\SOFTWARE\OpenSSH" `
            -Name DefaultShell `
            -Value "$PSHOME\powershell.exe"
  • Restart sshd and confirm that it is running:
    Restart-Service sshd
    Get-Service sshd

Validate connectivity from the Gateway

Run the following checks from the Gateway:

ping <IP-address-or-hostname>
telnet <IP-address-or-hostname> 22
ssh <username>@<IP-address-or-hostname>

The SSH connection must be established successfully, and PowerShell must be configured as the default shell. After connecting, run this command to verify the installed PowerShell version and confirm that PowerShell is the active shell:

$PSVersionTable.PSVersion

  • Non-admin account must be able to execute the command mongod --version, from Gateway machine.
  • Target mongodb windows server ip and port (default 27017) must be reachable from the gateway machine.

DB Privileges for Linux and Windows Base OS

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

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:
Field NameDescriptionField Type
NameA user-defined display name for the integration instanceString
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.
String
Base OSIn Standalone Mode, you can select either Linux or Windows as the Base OS.
Note: In Cluster Mode, only Linux is supported as the Base OS. Therefore, the Base OS field will not be visible.
String
IP Address/Host Name of MongoDB ServerIP Address/Hostname of the target.String
SSH PortSSH Port
Note: By default 22 is the port value
String
SSH CredentialsSelect the SSH credentials from the drop-down list.
Note: Click + Add to create a credential.
dropdown
MongoDB PortMongoDB Port
Note: By default 27017 is the prot value.
String
MongoDB Instance CredentialsSelect the MongoDB Instance Credentials from the drop-down list.
Note: Click + Add to create a credential.
dropdown
App Failure NotificationsWhen selected, you will be notified in case of an application failure such as Connectivity Exception, Authentication Exception.Checkbox

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 Native Types section, select the native types 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.

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

For Cluster Mode, Resource Filter Input keys are as follows.

Resource TypeSupported Input Keys
All TypesresourceName
hostName
aliasName
dnsName
ipAddress
macAddress
os
make
model
MongoDB ServerArbiter Node
Member Id
MongoDB Version
Root Resource IPAddress
Root Resource Name
Root Resource HostName
Domain Attributes
parentResourceName
parentResourceId
parentResourceIPAddress
parentResourceHostName

For Standalone Mode, Resource Filter Input keys are as follows.

Resource TypeSupported Input Keys
All TypesresourceName
hostName
aliasName
dnsName
ipAddress
macAddress
os
make
model
MongoDB ServerFor Linux Base OS
Arbiter Node
Member Id
MongoDB Version
For Windows Base OS
OS Version
OS Build Number
OS Architecture
Domain
MongoDB Service Name
MongoDB Service Status
MongoDB Port

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.aliasname}${resource.os}${resource.type}
${resource.dnsname}${resource.alternateip}${resource.make}
${resource.model}${resource.serialnumber}${resource.systemId}
${parent.resource.name}${Custome Attributes on the resource}${parentResourceName}
${parentResourceId}${parentResourceIPAddress}${parentResourceHostName}
${Domain 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.
  • 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.

Version History

Application VersionBug fixes / Enhancements
2.2.0Added support for MongoDB Standalone on windows.
2.1.1Added support to the following domain attributes for each non-root resource.
  • parentResourceName
  • parentResourceId
  • parentResourceIPAddress
  • parentResourceHostName

Note: If parentResourceId is missing but other attributes are present, run a full discovery once to capture the parentResourceId details.
2.1.0This implementation introduces third-party CI alert mapping and OpsQL-based enhancements.
Configure alert mappings to target CI systems through the application configuration. After configuration, the system automatically forwards alerts to the corresponding third-party platforms and maps them to the specified CIs, ensuring consistent integration and efficient alert management.
Previously, resource filters in the app configuration required manual entry of resource core and custom attributes. With this enhancement, the configuration is moved to OpsQL-based filtering, where users can see the keys auto-populated as needed.
2.0.2
  • Added code support for Get Target Response command for each native type
  • On demand latest snapshot support and Activity logger changes
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.