-
Notifications
You must be signed in to change notification settings - Fork 424
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/IndexStatsExcludeSystemCollections
- Loading branch information
Showing
46 changed files
with
1,771 additions
and
1,422 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,18 +91,24 @@ It will install `goimports`, `goreleaser`, `golangci-lint` and `reviewdog`. | |
|
||
The testing sandbox starts `n` MongoDB instances as follows: | ||
|
||
- 3 Instances for shard 1 at ports 17001, 17002, 17003 | ||
- 3 instances for shard 2 at ports 17004, 17005, 17006 | ||
- 3 Instances for shard 1 at ports 17001, 17002, 17003 (with no authentication) | ||
- 3 instances for shard 2 at ports 17004, 17005, 17006 (with authentication enabled) | ||
- 3 config servers at ports 17007, 17008, 17009 | ||
- 1 mongos server at port 17000 | ||
- 1 stand alone instance at port 27017 | ||
|
||
All instances are currently running without user and password so for example, to connect to the **mongos** you can just use: | ||
To connect to the **mongos** on shard 1, you can use: | ||
|
||
``` | ||
mongo mongodb://127.0.0.1:17001/admin | ||
``` | ||
|
||
To connect to the **mongos** on shard 2 (with authentication enabled), you can use: | ||
|
||
``` | ||
mongo mongodb://admin:[email protected]:17001/admin | ||
``` | ||
|
||
The sandbox can be started using the provided Makefile using: `make test-cluster` and it can be stopped using `make test-cluster-clean`. | ||
|
||
### Running tests | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,10 @@ Currently, these metric sources are implemented: | |
- replSetGetStatus | ||
- serverStatus | ||
|
||
## Supported MongoDB versions | ||
|
||
The exporter works with Percona Server for MongoDB and MongoDB Community or Enterprise Edition versions 4.4 and newer. Older versions might also work but are not tested anymore. | ||
|
||
## Info on Percona MongoDB exporter versions | ||
|
||
The old 0.1x.y version (ex `master` branch) has been moved to the `release-0.1x` branch. | ||
|
@@ -48,10 +52,10 @@ A docker image is available on the [official percona repository](https://hub.doc | |
|
||
```sh | ||
# with podman | ||
podman run -d -p 9216:9216 -p 17001:17001 percona/mongodb_exporter:0.20 --mongodb.uri=mongodb://127.0.0.1:17001 | ||
podman run -d -p 9216:9216 percona/mongodb_exporter:0.40 --mongodb.uri=mongodb://127.0.0.1:17001 | ||
|
||
# with docker | ||
docker run -d -p 9216:9216 -p 17001:17001 percona/mongodb_exporter:0.20 --mongodb.uri=mongodb://127.0.0.1:17001 | ||
docker run -d -p 9216:9216 percona/mongodb_exporter:0.40 --mongodb.uri=mongodb://127.0.0.1:17001 | ||
``` | ||
|
||
#### Permissions | ||
|
@@ -91,10 +95,14 @@ You can run the exporter specifying multiple URIs, devided by a comma in --mongo | |
```sh | ||
--mongodb.uri=mongodb://user:[email protected]:27017/admin,mongodb://user2:[email protected]:27018/admin | ||
``` | ||
In this case you can use the **/scrape** endpoint with the **target** parameter to retreive the specified tartget's metrics. When querying the data you can use just mongodb://host:port in the targer parameter without other parameters and, of course without host credentials | ||
In this case you can use the **/scrape** endpoint with the **target** parameter to retreive the specified tartget's metrics. When querying the data you can use just mongodb://host:port in the target parameter without other parameters and, of course without host credentials | ||
```sh | ||
GET /scrape?target=mongodb://127.0.0.1:27018 | ||
``` | ||
If your URI is prefixed by mongodb:// or mongodb+srv:// schema, any host not prefixed by it after comma is being treated as part of a cluster rather then as a standalone host. Thus clusters and standalone hosts can be combined like this: | ||
``` | ||
--mongodb.uri=mongodb+srv://user:pass@host1:27017,host2:27017,host3:27017/admin,mongodb://user2:pass2@host4:27018/admin | ||
``` | ||
|
||
|
||
#### Enabling collstats metrics gathering | ||
|
@@ -128,6 +136,17 @@ Usage example: `db.setProfilingLevel(2)` | |
|1| The profiler collects data for operations that take longer than the value of `slowms` or that match a filter.<br> When a filter is set: <ul><li> The `slowms` and `sampleRate` options are not used for profiling.</li><li>The profiler only captures operations that match the filter.</li></ul> | ||
|2|The profiler collects data for all operations.| | ||
|
||
#### Enabling shards metrics gathering | ||
When shard metrics collection is enabled by `--collector.shards`, the exporter will expose metrics related to sharded Mongo. | ||
Example, if shards collector is enabled: | ||
``` | ||
# HELP mongodb_shards_collection_chunks_count sharded collection chunks. | ||
# TYPE mongodb_shards_collection_chunks_count counter | ||
mongodb_shards_collection_chunks_count{collection="system.sessions",database="config",shard="rs1"} 250 | ||
mongodb_shards_collection_chunks_count{collection="system.sessions",database="config",shard="rs2"} 250 | ||
``` | ||
You can see shard name, it's collection, database and count. | ||
|
||
#### Cluster role labels | ||
The exporter sets some topology labels in all metrics. | ||
The labels are: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.