MongoDb Sharded Cluster with PMM2

The mongodb cluster summary dashboard has the “amount of collection in shards” and “size of collections in shards” panels.  If I add all the mongos servers to PMM2 the values in those charts is “Duplicate Matches”.  We have several mongos servers for redundancy and we’d like them all monitored.  Is there a way to have data present in those panels and have all mongos servers added with mongodb exporters?  (after adding the first mongos the values are properly populated.  After adding additional nodes the values change to “duplicate matches”).

Hi.

The point that a cluster might have 1, 2, or hundreds of mongos nodes is a tricky point for architecture of mongodb monitoring. There’s no final solution to this yet. Some people do want them, some people want none, but PMM requires at least 1, even though they add little that couldn’t be done with configsvr mongodb_exporter nodes alone.

In [PMM-6361] Failed to execute find query on 'config.chunks' - Percona JIRA it was noticed that the counting of chunks per shard can be very slow if you have a huge number of chunks, and multiplying that by mongodb_exporter on many mongos nodes (more likely the large the cluster is) just increased the load on the configsvr nodes, which is where the mongos nodes route the aggregation query through to.

So avoiding having a mongodb_exporter on more than small number of mongos nodes is the best approach (1 or 2 only).

For the issue of PMM-6361 a contributor’s patch recently added a flag (–suppress.collectshardingstatus) to mongodb_exporter. That will go into v0.11.2 when it is released. Or if you build the master branch as of this commit fix invalid memory address, added collect.shardingstatus flag (#199) · percona/mongodb_exporter@af0a25f · GitHub it might work already.

Using this –suppress.collectshardingstatus as default for all your mongos node mongodb_exporters (except 1 or 2 you manually keep as default) would be the second-best solution I think.

New version warning. This information above applies to v0.11*. Percona is intending to release a significantly updated version (maybe called v0.20) soon and things will change again. The names of metrics and flags will probably change at least.

Akira