Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

Commit

Permalink
Update mongodb.md (#1273)
Browse files Browse the repository at this point in the history
Fix updateRole command and warning not displayed properly
  • Loading branch information
igroene authored Jun 27, 2024
1 parent 70f0eef commit e1ad537
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions docs/setting-up/client/mongodb.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Run the example codes below in a `mongo` session to:
- create custom roles with the privileges required for creating/restoring backups and working with Query Analytics (QAN)
- create/update a database user with these roles above, plus the built-in `clusterMonitor` role

!!! caution alert alert-warning ""
!!! caution alert alert-warning "Important"
Values for username (`user`) and password (`pwd`) are examples. Replace them before using these code snippets.

### Create roles with privileges for backups and QAN
Expand Down Expand Up @@ -105,20 +105,20 @@ Run the example codes below in a `mongo` session to:

### Permissions for advanced metrics

To fetch advanced metrics, use the following to provide additional privileges to an existing PMM user:

```json
{
resource : {
db : "",
collection : "system.profile"
},
actions : [
"collStats",
"dbStats",
"indexStats"
]
}
To fetch advanced metrics like usage statistics for collection and indexes, use the following to provide additional privileges to an existing PMM user:

```{.javascript data-prompt=">"}
db.updateRole(
"explainRole",
{
privileges: [
{
resource: { db: "", collection: "" },
actions: ["collStats", "dbStats", "indexStats"]
}
]
}
)
```

## Profiling
Expand Down Expand Up @@ -181,15 +181,17 @@ For example, to enable the profiler in the `testdb`, run this:
```

!!! note alert alert-primary "Important"

If you have already [added the MongoDB service to PMM](#add-service), make sure to restart the PMM agent service after adjusting the profiling level.

## Add service

After configuring your database server, you can add a MongoDB service either through the user interface or via the command line.

!!! caution alert alert-warning "Important"
To monitor MongoDB sharded clusters, PMM requires access to all cluster components. Make sure to add all the config servers, shards, and at least 1-2 mongos routers. Otherwise, PMM will not be able to correctly collect metrics and populate dashboards.
Keep in mind that adding all mongos routers may cause excessive overhead.

To monitor MongoDB sharded clusters, PMM requires access to all cluster components. Make sure to add all the config servers, shards, and at least 1-2 mongos routers. Otherwise, PMM will not be able to correctly collect metrics and populate dashboards.
Keep in mind that adding all mongos routers may cause excessive overhead.

### On the command line

Expand Down

0 comments on commit e1ad537

Please sign in to comment.