Skip to content

Commit

Permalink
PMM-10680 enable pbm collector (#3162)
Browse files Browse the repository at this point in the history
* PMM-12848 Enable currentopmetrics collector in mongodb_exporter.

* PMM-7 fix golint.

* PMM-12848 Add currentopmetrics to scrape config.

* PMM-12848 collect currentopmetrics in low resolution.

* PMM-12848 Fix tests.

* PMM-13141 Enable fcv collector.

* enable pbm exporter by default

* enable pbm collector in 2.42

* move pbm collector to 2.43

* update scrape configs

* revert makefile changes

* drop fcv collector until it is recognized by mongodb exporter

* add release note highlight for PMM-10680

* merge both new mongodb exporter collectors

* enable pbm collector by default

* add new note for pbm collector

* apply suggestion

* fix tests

* fix typo

---------

Co-authored-by: Nurlan Moldomurov <[email protected]>
Co-authored-by: Nurlan Moldomurov <[email protected]>
  • Loading branch information
3 people authored Aug 26, 2024
1 parent 3d20f7d commit d9d956c
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 1 deletion.
24 changes: 23 additions & 1 deletion docs/release-notes/2.43.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,32 @@ pmm-admin add mongodb --enable-all-collectors ...
Specifying a limit with `--max-collections` for this collector is not necessary.

!!! note "Operation collection limitation"
To minimize impact on disk usage, the CurrentOp collector is designed to collect only operations that have been running for longer than 1 minute. This limitation helps focus on potentially problematic long-running operations while keeping data volume manageable.
To minimize impact on disk usage, the CurrentOp collector is designed to collect only operations that have been running for longer than 1 minute. This limitation helps focus on potentially problematic long-running operations while keeping data volume manageable.

For more information on MongoDB collectors and metrics, see the [pmm-admin commands documentation](../use/commamds/pmm-admin.md).

### Monitoring for Percona Backup for MongoDB
PMM now supports monitoring your Percona Backup for MongoDB (PBM) setup and provides PBM-related metrics such as `pbm-agent` statuses, PITR configuration, and backup statuses.
This is made possible via a new PBM collector in MongoDB exporter that gives you visibility to your PBM setup via these metrics:
- `mongodb_pbm_cluster_backup_configured`
- `mongodb_pbm_agent_status`
- `mongodb_pbm_cluster_pitr_backup_enabled`
- `mongodb_pbm_backup_size`
- `mongodb_pbm_backup_duration_seconds`

These metrics are enabled by default. If you're already running Percona Backup for MongoDB, you'll automatically receive these metrics without any additional configuration.
## Improvements

- [PMM-13133](https://perconadev.atlassian.net/browse/PMM-13133) -

- [PMM-13054](https://perconadev.atlassian.net/browse/PMM-13054) - The default number of log lines for each log file returned by `httsp://<pmm-server>/logs.zip` endpoint has been increased from 1,000 to 50,000.

Additionally, the endpoint now includes a customizable line-count parameter in the download URL, allowing you to specify a custom number of log lines or opt for unlimited log size. For more information, see the [API documentation](https://percona-pmm.readme.io/reference/logs).

- [PMM-13159](https://perconadev.atlassian.net/browse/PMM-13159) - We have removed the experimental MongoDB **Collection Details** dashboard from PMM. You can now find up-to-date collection information on the new Mongo **Cluster Summary** dashboard, which provides a more comprehensive and accurate view of MongoDB collection metrics.

If you have been using the **Collection Details** dashboard, make sure to now check the new **MongoDB Cluster Summary** dashboard for similar information.


## Maintenance

Expand Down
4 changes: 4 additions & 0 deletions managed/services/agents/mongodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ var (
v2_26_0 = version.MustParse("2.26.0-0")
v2_41_1 = version.MustParse("2.41.1-0")
v2_42_0 = version.MustParse("2.42.0-0")
v2_43_0 = version.MustParse("2.43.0-0")
)

// mongodbExporterConfig returns desired configuration of mongodb_exporter process.
Expand Down Expand Up @@ -109,6 +110,9 @@ func getArgs(exporter *models.Agent, tdp *models.DelimiterPair, listenAddress st
if !pmmAgentVersion.Less(v2_42_0) && collectAll { // >= 2.42.0
args = append(args, "--collector.currentopmetrics")
}
if !pmmAgentVersion.Less(v2_43_0) { // >= 2.43.0, enable pbm collector by default
args = append(args, "--collector.pbm")
}

args = collectors.FilterOutCollectors("--collector.", args, exporter.DisabledCollectors)
args = append(args, collectors.DisableDefaultEnabledCollectors("--no-collector.", defaultEnabledCollectors, exporter.DisabledCollectors)...)
Expand Down
78 changes: 78 additions & 0 deletions managed/services/agents/mongodb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,84 @@ func TestMongodbExporterConfig2411(t *testing.T) {
})
}

func TestMongodbExporterConfig2430(t *testing.T) {
pmmAgentVersion := version.MustParse("2.43.0")
node := &models.Node{
Address: "1.2.3.4",
}
mongodb := &models.Service{
Address: pointer.ToString("1.2.3.4"),
Port: pointer.ToUint16(27017),
}
exporter := &models.Agent{
AgentID: "agent-id",
AgentType: models.MongoDBExporterType,
Username: pointer.ToString("username"),
Password: pointer.ToString("s3cur3 p@$$w0r4."),
AgentPassword: pointer.ToString("agent-password"),
}
actual, err := mongodbExporterConfig(node, mongodb, exporter, redactSecrets, pmmAgentVersion)
expected := &agentpb.SetStateRequest_AgentProcess{
Type: inventorypb.AgentType_MONGODB_EXPORTER,
TemplateLeftDelim: "{{",
TemplateRightDelim: "}}",
Args: []string{
"--collector.diagnosticdata",
"--collector.pbm",
"--collector.replicasetstatus",
"--compatible-mode",
"--discovering-mode",
"--mongodb.global-conn-pool",
"--web.listen-address=0.0.0.0:{{ .listen_port }}",
"--web.config={{ .TextFiles.webConfigPlaceholder }}",
},
Env: []string{
"MONGODB_URI=mongodb://username:s3cur3%20p%[email protected]:27017/?connectTimeoutMS=1000&directConnection=true&serverSelectionTimeoutMS=1000",
},
RedactWords: []string{"s3cur3 p@$$w0r4.", "agent-password"},
TextFiles: map[string]string{
"webConfigPlaceholder": "basic_auth_users:\n pmm: agent-password\n",
},
}
require.NoError(t, err)
requireNoDuplicateFlags(t, actual.Args)
require.Equal(t, expected.Args, actual.Args)
require.Equal(t, expected.Env, actual.Env)
require.Equal(t, expected, actual)

t.Run("Enabling all collectors", func(t *testing.T) {
exporter.MongoDBOptions = &models.MongoDBOptions{
EnableAllCollectors: true,
StatsCollections: []string{"db1.col1.one", "db2.col2", "db3"},
}

expected.Args = []string{
"--collector.collstats",
"--collector.collstats-limit=0",
"--collector.currentopmetrics",
"--collector.dbstats",
"--collector.diagnosticdata",
"--collector.indexstats",
"--collector.pbm",
"--collector.replicasetstatus",
"--collector.shards",
"--collector.topmetrics",
"--compatible-mode",
"--discovering-mode",
// this should be here even if limit=0 because it could be used to filter dbstats
// since dbstats is not depending on the number of collections present in the db.
"--mongodb.collstats-colls=db1.col1.one,db2.col2,db3",
"--mongodb.global-conn-pool",
"--mongodb.indexstats-colls=db1.col1.one,db2.col2,db3",
"--web.listen-address=0.0.0.0:{{ .listen_port }}",
"--web.config={{ .TextFiles.webConfigPlaceholder }}",
}
actual, err := mongodbExporterConfig(node, mongodb, exporter, exposeSecrets, pmmAgentVersion)
require.NoError(t, err)
require.Equal(t, expected.Args, actual.Args)
})
}

func TestMongodbExporterConfig(t *testing.T) {
pmmAgentVersion := version.MustParse("2.0.0")
node := &models.Node{
Expand Down
3 changes: 3 additions & 0 deletions managed/services/victoriametrics/scrape_configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,9 @@ func scrapeConfigsForMongoDBExporter(params *scrapeConfigParams) ([]*config.Scra
if !params.pmmAgentVersion.Less(version.MustParse("2.42.0-0")) {
defaultCollectors = append(defaultCollectors, "currentopmetrics")
}
if !params.pmmAgentVersion.Less(version.MustParse("2.43.0-0")) {
defaultCollectors = append(defaultCollectors, "pbm")
}

lr, err := scrapeConfigForStandardExporter("lr", params.metricsResolution.LR, params, defaultCollectors)
if err != nil {
Expand Down

0 comments on commit d9d956c

Please sign in to comment.