title | tags | metaDescription | freshnessValidatedDate | |||
---|---|---|---|---|---|---|
MongoDB monitoring migration guide |
|
New Relic's MongoDB integration: how migrate from legacy to to the new version. |
never |
The existing legacy version will be deprecated and no longer supported during FY24.
The new version brings these benefits in comparison with the legacy version:
- Support of the latest major MongoDB versions 5 and 6.
- Compatibility with Percona Server for MongoDB.
- Compatibility with MongoDB Atlas.
- Support of SCRAM authentication.
- Integration with the entity explorer thanks to 3 new entity types (MongoDB instance, database, and collection).
- Improved new MongoDB quickstart.
You just need to uninstall the legacy integration and install the new version. In case of need, both versions can coexist in the same host and monitor the same MongoDB instance.
The new MongoDB integration reports dimensional metrics which have a different structure from sample metrics reported by the legacy integration.
To help you find your old metrics in the new format, see these examples on how they should be queried.
There're several specific dimensions added depending on the metric. Check which dimensions are assigned to each metric on our metric list.
Metrics from the legacy `MongoCollectionSample` are reported under the prefix `mongodb_collstats_`.These specific dimensions have been added: `database` and `collection`. Use them to narrow down your queries to a specific database and/or collection.
<table>
<thead>
<tr>
<th>
Legacy metric
</th>
<th>
New metric
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
`collection.avgObjSizeInBytes`
</td>
<td>
`mongodb_collstats_storageStats_avgObjSize`
</td>
</tr>
<tr>
<td>
`collection.count`
</td>
<td>
`mongodb_collstats_storageStats_count`
</td>
</tr>
<tr>
<td>
`collection.nindexes`
</td>
<td>
`mongodb_collstats_storageStats_nindexes`
</td>
</tr>
</tbody>
</table>
Collection metrics report latency metrics per collection under the prefix `mongodb_collstats_latencyStats_`.
This is an example of query:
```sql
FROM Metric SELECT latest(mongodb_collstats_storageStats_size) WHERE database='DB1' AND collection='Collection1'
```
<Collapser id="config_server-samples" title="Config Server Samples"
Metrics from the legacy `MongoConfigServerSample` are reported under the prefix `mongodb_ss_` (Server Stats) with the `cl_role` dimension populated with an empty value.
There're several specific dimensions added depending on the metric. Check which dimensions are assigned to each [metric](/docs/infrastructure/host-integrations/host-integrations-list/mongodb/mongodb-monitoring-integration-new/#metrics).
<table>
<thead>
<tr>
<th>
Legacy metric
</th>
<th>
New metric
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
`asserts.regularPerSecond`
</td>
<td>
`mongodb_ss_asserts`
You can use the `assert_type` dimension to retrieve the value for a specific type of assertion. In this case `assert_type='regular'`.
</td>
</tr>
<tr>
<td>
`commands.insertPerSecond`
</td>
<td>
`mongodb_ss_metrics_commands_insert_total`
</td>
</tr>
<tr>
<td>
`connections.current`
</td>
<td>
`mongodb_ss_connections`
You can use the `conn_type` dimension to retrieve the value for a specific type of connection. In this case `conn_type='current'`.
</td>
</tr>
<tr>
<td>
`wiredtiger.cachePagesHeld`
</td>
<td>
`mongodb_ss_wt_cache_pages_currently_held_in_the_cache`
All WiredTiger engine related metrics report with the prefix `mongodb_ss_wt_`.
</td>
</tr>
</tbody>
</table>
This is an example of query to retrieve the latest status on server connections:
```sql
FROM Metric SELECT latest(mongodb_ss_connections) FACET conn_type
```
<Collapser id="database-samples" title="Database Samples"
Metrics from the legacy `MongoDatabaseSample` are reported under the prefix `mongodb_dbstats_`.
You can use the `database` dimension to narrow down your queries to a specific database.
<table>
<thead>
<tr>
<th>
Legacy metric
</th>
<th>
New metric
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
`stats.objects`
</td>
<td>
`mongodb_dbstats_objects`
</td>
</tr>
<tr>
<td>
`totalDatabases`
</td>
<td>
Since each database is reported as a dimension, there's no direct replacement for `totalDatabases`.
You can obtain the total number of databases by counting the unique values under the `database` dimension:
```sql
FROM Metric SELECT uniqueCount(database) WHERE mongodb_cluster_name='your_cluster'
```
</td>
</tr>
</tbody>
</table>
<Collapser id="top-samples" title="Top Samples"
Metrics from the legacy `MongodTopSample` are reported under the prefix `mongodb_top_`.
You can use the `database` and `collection` dimensions to narrow down your queries to a specific database and/or collection.
<table>
<thead>
<tr>
<th>
Legacy metric
</th>
<th>
New metric
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
`usage.queriesPerSecond`
</td>
<td>
`mongodb_top_queries_count`
</td>
</tr>
<tr>
<td>
`usage.queriesInMillisecondsPerSecond`
</td>
<td>
`mongodb_top_queries_time`
</td>
</tr>
</tbody>
</table>
This is an example of query to get a time series of the frequency of insert commands:
```sql
SELECT derivative(mongodb_top_insert_time, 1 minute) / 1000 AS 'Inserts' Metric WHERE mongodb_cluster_name='your_cluster' TIMESERIES
```
<Collapser id="mongo-samples" title="Mongo Samples"
Mongo Sample reports the `totalDatabases` metric, which hasn't direct correspondence on the new integration.
To retrieve the total number of databases, see this example:
<table>
<thead>
<tr>
<th>
Legacy metric
</th>
<th>
New metric
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
`totalDatabases`
</td>
<td>
Since each database is reported as a dimension there isn't direct replacement for `totalDatabases`.
You can obtain the total number of databases by counting the unique values under the `database` dimension:
```sql
FROM Metric SELECT uniqueCount(database) WHERE mongodb_cluster_name='your_cluster'
```
</td>
</tr>
</tbody>
</table>
<Collapser id="mongod-samples" title="Mongod Samples"
Mongod metrics are the same as Config Server metrics but the `cl_role` dimension is populated with a value of `shardsvr`.
<Collapser id="mongos-samples" title="Mongos Samples"
Mongos metrics are the same as Config Server metrics but the `cl_role` dimension is populated with a value of `mongos`.