Configuring a MongoDB environment


This topic provides information about configuring the MongoDB monitor type. The MongoDB monitor type is used to monitor the MongoDB database computers. The MongoDB monitor type can be configured to monitor the MongoDB database MongoS parameters, MongoDB cluster parameters, and the replica set member parameters.

Configuring the MongoDB monitor type

In the Add Monitor Types dialog box, with the Monitoring Profile set to MongoDB Monitoring, and the Monitor Type set to MongoDB, provide the following details:

Global setting

Field

Description

Java home

Specify the path to the JRE directory (aka $JAVA_HOME environment variable) on the PATROL Agent host.

If you enter a path for the JRE directory, you must enter the full path, such as C:\Program files\Java\jre1.8.0_151. Do not use the short path format.

If you do not enter a value in this field or use JAVA_HOME or $JAVA_HOME, the KM looks for the JAVA_HOME environment variable or Java installed in the PATROL Agent home directory.

Global logging

Select the check box to turn on the PSL debug at a global level.

MongoDB Configuration

Field

Description

MongoDB environment

Enter the name for the MongoDB database environment.

Host name

Enter the host name or IP number that you want to monitor.

Port number

Enter the port number of the instance that you want to monitor.

Excluded DBs

Enter the MongoDB databases that you want to exclude from monitoring. Separate the databases by using a semicolon (;), comma (,), or space.

Use authentication

User name

Enter the username to connect to the database.

User password

Enter the password to connect to the database.

Authentication mechanism

Select the mechanism to authenticate the MongoDB server credentials:

  • LDAP
  • SCRAM-SHA-1
  • SCRAM-SHA-256


Important

When using authentication, ensure that the user has read privilege to admin and local databases at all Mongo components. 

If MongoDB is a cluster, the user needs to have ClusterMonitor for admin DB also.


SSL certificate details

Field

Description

Enable TLS

Select the Enable TLS option to establish a connection with the MongoDB cluster. This option enables TLS connectivity without the need for any certificates.

Important: Ensure that this option is set up during the installation/configuration of MongoDB.

TrustStore file

Enter the path to the directory where the TrustStore certificates are located. The input to this field is the full path of JKS or PEM file.

If you have KeyStore file only, enter its path in this field.

To create key and certificate files by using openssl
  1. Create a key by using the openssl utility.
    openssl req -new -x509 -days 365 -nodes -out <replica set name>.crt -keyout <replica set name>.key
  2. Create the .p12 file from the generated .key and .crt files.
    openssl pkcs12 -export -in <replica set name>.crt -inkey <replica set name>.key -certfile <replica set name>.crt -out <replica set name>.p12
  3. Generate the .jks files by using Java keytool (from %JAVA_HOME%\bin).
    Note: Do not override the certificate. Use alias as hostname from the second replica set member onwards.
    ./keytool -importkeystore -srckeystore <replica set name>.p12 -srcstoretype pkcs12 -destkeystore myJksFile.jks -deststoretype JKS
  4. Copy the myJksFile.jks file to the PATROL Agent host in the Patrol3 directory and use this file path in the TrustStore file field.
  5. Create the .pem file for the MongoDB server by using the key and certificate files.
    cat <replica set name>.key <replica set name>.crt > <replica set name>.pem
  6. Start the MongoDB server process by using the .pem file path.
    ./mongod --tlsMode requireTLS --dbpath ../mongodb --logpath ../log/mongo.log --replSet <replica set name> --bind_ip localhost,<local hostname> --tlsCertificateKeyFile /home/mongod/test/<replica set name>.pem &
  7. Copy the .pem (like <replica set name>.pem) file to the replica set member host. 
  8. Repeat these steps for all replica set members.
To Import the self-signed key and certificate files
  1. Convert the .pem file to .p12  by using the following commands on the respective replica set member host.
    openssl pkcs12 -export -in <replica set name>.pem -inkey server.key -certfile <replica set name>.pem -out <replica set name>.p12
  2. Copy the .p12 file on the PATROL Agent host to the java/jre folder where the keytool utility is available.
  3. Import the certificate to the .jks file by using the following command:
    Important:
    Do not override the certificate. Use alias as hostname for the second replica set member onwards.
    ./keytool -importkeystore -srckeystore <replica set name>.p12 -srcstoretype pkcs12 -destkeystore myJksFile.jks -deststoretype JKS
  4. Copy the myJksFile.jks file to the /Patrol3 directory that is accessible by the PATROL user.
  5. Enter the path of the myJksFile.jks file in the TrustStore file field.
  6. Repeat these steps for all replica set members.

TrustStore password

Enter the TrustStore file password.

If you have KeyStore file only and you are entering its path in the TrueStore file field, enter the KeyStore file password.

Important: A password is required only when using a JKS file. If you are using a PEM file, a password is not required.

KeyStore file

Enter the path to the directory where the KeyStore certificates are located.

Important: The KeyStore file and its password are required only when using a JKS file. If you are using a PEM file, KeyStore file details are not needed.

KeyStore password

Enter the KeyStore file password.


KM Admin

Field

Description

Discovery interval (mins)

Specify the time interval between discovery cycles, in minutes.

ReplicaSet member to device

Select to display each host separately. Instance to Device is enabled by default.

Data collection logging

Select the check box to turn the logging on or off for the MongoDB environment you want to configure. By default, the data collection logging is turned off.

MongoS parameters

Field

Description

  • Number of inserts
  • Number of queries
  • Number of updates
  • Number of deletes
  • Number of getMore
  • Number of command
  • Virtual memory size
  • Resident memory size
  • Number of network bytes in
  • Number of network bytes out
  • Number of open connections
  • Number of network requests
  • Number of asserts warning
  • Number of asserts messages
  • Number of asserts users
  • Number of page faults
  • Number of asserts regular

Select one or more from the list of parameters to enable monitoring the MongoS parameters.

Cluster parameters

Field

Description

  • Number of chunks
  • Chunk size
  • Number db client connection
  • Number of exception safe connections
  • Total available connections
  • Total created connections

Select one or more from the list of parameters to enable monitoring the cluster parameters.

Database parameters

Field

Description

  • File size
  • Index size
  • Storage size
  • Number of extents
  • Number of indexes
  • Number of collections
  • Number of objects
  • Average object size
  • Data size
  • Name space size

Select one or more from the list of parameters to enable monitoring the database parameters.

Member parameters

Field

Description

  • Lag in replicating
  • Log file size
  • OP log length
  • Log file used MBs
  • Number of inserts
  • Number of queries
  • Number of updates
  • Number of deletes
  • Number of getMore
  • Number of command
  • Mapped memory size
  • Virtual memory size
  • Resident memory size
  • Queue read write
  • Number active clients
  • Number of network bytes in
  • Number of network bytes out
  • Number of open connections
  • Number of network requests
  • Number of asserts warning
  • Number of asserts messages
  • Number of asserts users
  • Number of queue readers
  • Number of queue writers
  • Number of page faults
  • Number of asserts regular
  • Database total size on disk
  • Number of long running operations

Select one or more from the list of parameters to enable monitoring the ReplicaSet Member parameters

Long running operations filter

Field

Description

Long running time (sec)

Specify the long running operations period in seconds. By default, the time is 60 sec.

Important: If Operation and NameSpace are empty, it fetches for ALL operations that are running more than the set time.

Filter action

Specify the Include or Exclude filter operation. Include is selected by default.

Namespace list

Specify the namespace that you want to exclude from monitoring. Separate the list by using a semicolon (;), comma (,), or space. By default, it is user;analytics.For example, user,analytics

Operation list

Specify the operations that you want to exclude from monitoring. Separate the list by using a semicolon (;), comma (,), or space. By default, it specifies the field with the query.

For example, query,insert