Configuring MongoDB, Version 5.1.1

This section describes the required configurations as well as the optional configurations available for the Solution Package for MongoDB in the RTView Configuration Application. You must define the classpath to the Mongo DB jar file and you must also define data source connections for each database connection that you want to monitor. 

Configuring Data Collection

Use the RTView Configuration Application to configure your data collection.

  • Navigate to Solution Package Configuration > MongoDB.
  • On the CONNECTIONS tab, provide the correct full path to the directory containing the Mongo DB jar file in the Classpath field.

  • In the Connections region, click the  icon.

The Add Connection dialog displays.

  • Specify the connection information and click SAVE where:

Connection Name: Enter the name you want to specify for the connection.

URL: add the following lines for each MongoDB database to which you want to connect (to enable the Monitor to collect data from them):

The connection string should use the following format:

mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]

mongodb:// is a required prefix to identify that this is a string in the standard connection format.

username:password@ are optional. If given, the driver will attempt to login to a database after connecting to a database server. For some authentication mechanisms, only the username is specified and the password is not, in which case the ":" after the username is left off.

host1 is the only required part of the URI. It identifies a server address to which to connect.

:portX is optional and defaults to :27017 if not provided.

/database is the name of the database to login to and thus is only relevant if the username:password@ syntax is used. If not specified, the admin database will be used by default.

?options are connection options. Note that if the database is absent, there is still a / required between the last host and the ? introducing the options. Options are name=value pairs and the pairs are separated by &. For backwards compatibility, ; is accepted as a separator in addition to &, but should be considered as deprecated.

Example for two database connections:

Name= Mongo1 URL=  mongodb://myUserAdmin:abc123@123.4.567.890:27017

Name= Mongo2 URL= mongodb://123.456.789.012:27027

The newly created connection displays in the Connections section.

  • You can optionally modify the Poll Rates (query interval, in seconds) that will be used to collect the metric data for the MongoDatabase, MongoInstance, and MongoCollection caches by clicking on the DATA COLLECTION tab and entering the desired polling rate.

Configuring Historical Data Collection (Optional)

You can specify the number of history rows to store in memory, the compaction rules, the duration before metrics are expired and deleted, and the different types of metrics that you want the Historian to store in the DATA STORAGE tab in the RTView Configuration Application. Once you have made all of your changes, you need to save your changes in the RTView Configuration Application and restart your data server for the changes to take place.

Defining the Storage of In-Memory History

You can modify the maximum number of history rows to store in memory in the DATA STORAGE tab. The History Rows property defines the maximum number of rows to store for the MongoDatabase, MongoInstance, and MongoCollection caches. The default settings for History Rows is 50,000. To update the default setting:

  • Navigate to the Solution Package Configuration > MongoDB > DATA STORAGE tab.
  • In the Size region, click the History Rows field and specify the desired number of rows.

Defining Compaction Rules

Data compaction, essentially, is taking large quantities of data and condensing it using a defined rule so that you store a reasonably sized sample of data instead of all of your data, thus preventing you from potentially overloading your database. The available fields are:

Condense Interval -- The time interval at which the cache history is condensed for the following caches: MongoDatabase, MongoInstance, and MongoCollection. The default is 60 seconds.

Condense Raw Time -- The time span of raw data kept in the cache history table for the following caches: MongoDatabase, MongoInstance, and MongoCollection. The default is 1200 seconds.

History Time Span -- The time span of data kept in the cache history table for the following caches: MongoDatabase, MongoInstance, and MongoCollection. The default is 1296000 seconds.

Compaction Rules -- This field defines the rules used to condense your historical data in the database for the following caches: MongoDatabase, MongoInstance, and MongoCollection. By default, the columns kept in history will be aggregated by averaging rows with the following rule 1h -;1d 5m;2w 15m, which means the data from 1 hour will not be aggregated (1h - rule), the data over a period of 1 day will be aggregated every 5 minutes (1d 5m rule), and the data over a period of 2 weeks old will be aggregated every 15 minutes (2w 15m rule).

  • Navigate to the Solution Package Configuration > MongoDB > DATA STORAGE tab.
  • In the Compaction region, click the Condense Interval, Condense Raw Time, History Time Span, and Compaction Rules fields and specify the desired settings.

Note: When you click in the Compaction Rules field, the Copy default text to clipboard link appears, which allows you copy the default text (that appears in the field) and paste it into the field. This allows you to easily edit the string rather than creating the string from scratch.

Defining Expiration and Deletion Duration for MongoDB Metrics

The data for each metric is stored in a specific cache and, when the data is not updated in a certain period of time, that data will either be marked as expired or, if it has been an extended period of time, it will be deleted from the cache altogether. By default, metric data will be set to expired when the data in the cache has not been updated within 45 seconds. Also, by default, if the data has not been updated in the cache within 3600 seconds, it will be removed from the cache. The following caches are impacted by settings in the Expire Time and Delete Time fields: MongoDatabase, MongoInstance, and MongoCollection. To modify these defaults:

  • Navigate to the Solution Package Configuration > MongoDB > DATA STORAGE tab.
  • In the Duration region, click the Expire Time and Delete Time fields and specify the desired settings.

Enabling/Disabling Storage of Historical Data

The History Storage section allows you to select which metrics you want the Historian to store in the history database. By default, historical Collections (MongoCollection cache), Databases (MongoDatabase cache), and Instances (MongoInstance cache) are saved to the database. To disable the collection of this historical data, perform the following steps:

  • Navigate to the Solution Package Configuration > MongoDB > DATA STORAGE tab.
  • In the History Storage region, deselect the toggles for the metrics that you do not want to collect. Blue is enabled, gray is disabled.

Defining a Prefix for All History Table Names for MONGOMON Metrics

The History Table Name Prefix field allows you to define a prefix that will be added to the database table names so that the Monitor can differentiate history data between data servers when you have multiple data servers with corresponding Historians using the same solution package(s) and database. In this case, each Historian needs to save to a different table, otherwise the corresponding data server will load metrics from both Historians on startup. Once you have defined the History Table Name Prefix, you will need to create the corresponding tables in your database as follows:

  • Locate the .sql template for your database under rtvapm/mongomon/dbconfig and make a copy of template.
  • Add the value you entered for the History Table Name Prefix to the beginning of all table names in the copied .sql template.
  • Use the copied .sql template to create the tables in your database.

Note: If you are using Oracle for your Historian Database, you must limit the History Table Name Prefix to 2 characters because Oracle does not allow table names greater than 30 characters (and the longest table name for the solution package is 28 characters).

To add the prefix:

  • Navigate to Solution Package Configuration > MongoDB > DATA STORAGE tab.
  • Click on the History Table Name Prefix field and enter the desired prefix name.