Skip to content

Commit 43bebd5

Browse files
Update mongodb.md (#4924)
* Update mongodb.md Make it more clear about the new convention for --cluster argument * Update mongodb.md * Update mongodb.md * Update mongodb.md * Update documentation/docs/install-pmm/install-pmm-client/connect-database/mongodb.md Co-authored-by: Catalina A <94133018+catalinaadam@users.noreply.github.com> --------- Co-authored-by: Catalina A <94133018+catalinaadam@users.noreply.github.com>
1 parent 6e88804 commit 43bebd5

File tree

1 file changed

+45
-45
lines changed
  • documentation/docs/install-pmm/install-pmm-client/connect-database

1 file changed

+45
-45
lines changed

documentation/docs/install-pmm/install-pmm-client/connect-database/mongodb.md

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -24,53 +24,53 @@ Role privileges depend on:
2424

2525
### Create monitoring role
2626

27-
After connecting to your MongoDB instance, create custom role with the privileges required for metric collection, working with Query Analytics (QAN) and optionally creating/restoring backups:
27+
After connecting to your MongoDB instance, create a custom role with the privileges required for metric collection, working with Query Analytics (QAN) and optionally creating/restoring backups:
2828

29-
!!! caution alert alert-warning "Important"
30-
Values for username (`user`) and password (`pwd`) are examples. Replace them before using these code snippets.
29+
#### Minimum privileges
30+
31+
This role grants the essential minimum privileges needed for monitoring and QAN:
32+
33+
```javascript
34+
db.getSiblingDB("admin").createRole({
35+
"role": "pmmMonitor",
36+
"privileges": [
37+
{
38+
"resource": { "db": "", "collection": "" },
39+
"actions": [ "dbHash", "find", "listIndexes", "listCollections", "collStats", "dbStats", "indexStats" ]
40+
},
41+
{
42+
"resource": { "db": "", "collection": "system.version" },
43+
"actions": [ "find" ]
44+
},
45+
{
46+
"resource": { "db": "", "collection": "system.profile" },
47+
"actions": [ "dbStats", "collStats", "indexStats" ]
48+
}
49+
],
50+
"roles": [ ]
51+
})
52+
```
53+
54+
#### Full backup management privileges
3155

32-
=== "Minimum privileges"
33-
This role grants the essential minimum privileges needed for monitoring and QAN:
34-
```javascript
35-
db.getSiblingDB("admin").createRole({
36-
"role": "pmmMonitor",
56+
If you plan to use PMM's backup features, also create a role with full backup management privileges:
57+
58+
```javascript
59+
db.getSiblingDB("admin").createRole({
60+
"role": "pbmAnyAction",
3761
"privileges": [
38-
{
39-
"resource": { "db": "", "collection": "" },
40-
"actions": [ "dbHash", "find", "listIndexes", "listCollections", "collStats", "dbStats", "indexStats" ]
41-
},
42-
{
43-
"resource": { "db": "", "collection": "system.version" },
44-
"actions": [ "find" ]
45-
},
46-
{
47-
"resource": { "db": "", "collection": "system.profile" },
48-
"actions": [ "dbStats", "collStats", "indexStats" ]
49-
}
62+
{
63+
"resource": { "anyResource": true },
64+
"actions": [ "anyAction" ]
65+
}
5066
],
51-
"roles": [ ]
52-
})
53-
```
54-
55-
=== "Full backup management privileges"
56-
If you plan to use PMM's backup features, create a role with full backup management privileges:
57-
58-
```javascript
59-
db.getSiblingDB("admin").createRole({
60-
"role": "pbmAnyAction",
61-
"privileges": [
62-
{
63-
"resource": { "anyResource": true },
64-
"actions": [ "anyAction" ]
65-
}
66-
],
67-
"roles": []
68-
});
69-
```
67+
"roles": []
68+
});
69+
```
7070

7171
### Create user and assign created role
7272

73-
After creating the role, create the PMM user and assign role based on your MongoDB version and requirements:
73+
After creating the custom roles, create the PMM user and assign the roles based on your MongoDB version and requirements:
7474

7575
=== "MongoDB 8.0+ (Standard)"
7676
MongoDB 8.0 introduced stricter security for direct shard access. For MongoDB 8.0 and later, the PMM user also requires the `directShardOperations` role to collect complete metrics from all cluster components:
@@ -349,7 +349,7 @@ After configuring your database server, add a MongoDB service using either the u
349349
--password=your_secure_password \
350350
--host=127.0.0.1 \
351351
--port=27017 \
352-
--cluster=my_cluster_name \
352+
--cluster=my_cluster_or_rs_name \
353353
--enable-all-collectors
354354
```
355355

@@ -360,7 +360,7 @@ After configuring your database server, add a MongoDB service using either the u
360360
--password=your_secure_password \
361361
--host=127.0.0.1 \
362362
--port=27017 \
363-
--cluster=my_cluster_name \
363+
--cluster=my_cluster_or_rs_name \
364364
--enable-all-collectors \
365365
--tls-skip-verify
366366
```
@@ -372,7 +372,7 @@ After configuring your database server, add a MongoDB service using either the u
372372
--password=your_secure_password \
373373
--host=127.0.0.1 \
374374
--port=27017 \
375-
--cluster=my_cluster_name \
375+
--cluster=my_cluster_or_rs_name \
376376
--enable-all-collectors \
377377
--query-source=mongolog
378378
```
@@ -390,14 +390,14 @@ After configuring your database server, add a MongoDB service using either the u
390390
--tls-ca-file=/path/to/ca.pem \
391391
--authentication-mechanism=MONGODB-X509 \
392392
--authentication-database=$external \
393-
--cluster=my_cluster_name \
393+
--cluster=my_cluster_or_rs_name \
394394
--enable-all-collectors
395395
```
396396

397397
When successful, PMM Client will print `MongoDB Service added` with the service's ID and name. Use the `--environment` and `--custom-labels` options to set tags for the service to help identify them.
398398

399399
!!! hint alert alert-success "Tips"
400-
- When adding nodes to a sharded cluster, ensure to add each node using the same `--cluster mycluster` option. This allows the [MongoDB Cluster Summary](../../../reference/dashboards/dashboard-mongodb-cluster-summary.md) dashboard to populate correctly.
400+
- When adding members of a replica set or sharded cluster, ensure to add each node using the same `--cluster my_cluster_or_rs_name`. This allows the [MongoDB Cluster Summary](../../../reference/dashboards/dashboard-mongodb-cluster-summary.md) and [MongoDB ReplSetSummary](../../../reference/dashboards/dashboard-mongodb-replset-summary.md) dashboards to populate correctly.
401401
- PMM does not gather collection and index metrics if it detects you have more than 200 collections, in order to limit the resource consumption. Check the [advanced options](../../../use/commands/pmm-admin.md#advanced-options) section if you want to modify this behaviour.
402402
- When running mongos routers in containers, specify the `diagnosticDataCollectionDirectoryPath` to ensure that pmm-agent can properly capture mongos metrics. For example: `mongos --setParameter diagnosticDataCollectionDirectoryPath=/var/log/mongo/mongos.diagnostic.data/`
403403

0 commit comments

Comments
 (0)