# PMM's MongoDB dashboards for "Index Scan Ratios" and "Document Scan Ratios" stay on "NO DATA"

**URL:** <https://forums.percona.com/t/pmms-mongodb-dashboards-for-index-scan-ratios-and-document-scan-ratios-stay-on-no-data/26291>\
**Category:** PMM 2.x\
**Tags:** mongodb\
**Created:** [November 1, 2023, 2:44pm UTC](https://forums.percona.com/t/pmms-mongodb-dashboards-for-index-scan-ratios-and-document-scan-ratios-stay-on-no-data/26291 "2023-11-01T14:44:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![hvtilborg](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/hvtilborg/32/13599_2.png) [@hvtilborg](https://forums.percona.com/u/hvtilborg)\
**Post date:** [November 1, 2023, 2:44pm UTC](https://forums.percona.com/t/pmms-mongodb-dashboards-for-index-scan-ratios-and-document-scan-ratios-stay-on-no-data/26291/1 "2023-11-01T14:44:46Z")

</div>

## Description:

I just configured my MongoDB 6.0.6 instance to register at my PMM 2.40.1 server. That all worked out fine. I receive OS information and such.

Next, I created the two user roles as described in [Percona Monitoring and Management](https://docs.percona.com/percona-monitoring-and-management/setting-up/client/mongodb.html#create-roles-with-privileges-for-backups-and-qan). And then created the “pmm” user as described by the referenced document. I also made sure that the `explainRole` contained access to the `system.profile` collection for each DB as well, as prescribed by [Percona Monitoring and Management](https://docs.percona.com/percona-monitoring-and-management/setting-up/client/mongodb.html#permissions-for-advanced-metrics).

In the MongoDB shell, I enabled profiling for the two databases I wanted to specifically monitor performance for, namely `ixplatform_a` and `ixplatform_b`, using this:

```auto
use ixplatform_a;
db.setProfilingLevel(2, {slowms: 100, sampleRate: 0.1});
use ixplatform_b;
db.setProfilingLevel(2, {slowms: 100, sampleRate: 0.1});

```

Next, I added / registered the MongoDB service to PMM, using this command:

```auto
pmm-admin add mongodb --query-source=profiler --username=pmm --password=xyz --cluster=cluster-name --enable-all-collectors --stats-collections=ixplatform_a,ixplatform_b server-name 127.0.0.1

```

Now, all Grafana dashboard fill up nicely and also the QAN receives query usage information. However, the only two Grafana graphs / dashboards that stay empty, are the ones under “Query Efficiency Detail”:

- Index Scan Ratios
- Document Scan Ratios

What am I missing here? Is the `pmm-admin add mongodb` command wrong? Are the permissions for the MongoDB “pmm” user wrong? Should I give more specific access to the `ixplatform_a` & `ixplatform_b` databases?

## Version:

MongoDB: 6.0.6  
PMM: 2.40.1

---

<div class="post-metadata">

**Author:** ![hvtilborg](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/hvtilborg/32/13599_2.png) [@hvtilborg](https://forums.percona.com/u/hvtilborg)\
**Post date:** [November 2, 2023, 7:37am UTC](https://forums.percona.com/t/pmms-mongodb-dashboards-for-index-scan-ratios-and-document-scan-ratios-stay-on-no-data/26291/2 "2023-11-02T07:37:48Z")

</div>

To add to this, it looks like the `mongodb_exporter` gets the correct calling arguments:

```sh
$ ps ax | grep mongodb_exporter
1694059 ? Sl 93:44 /usr/local/percona/pmm2/exporters/mongodb_exporter --collector.collstats --collector.collstats-limit=200 --collector.dbstats --collector.diagnosticdata --collector.indexstats --collector.replicasetstatus --collector.topmetrics --compatible-mode --discovering-mode --log.level=warn --mongodb.collstats-colls=ixplatform_a,ixplatform_b --mongodb.global-conn-pool --mongodb.indexstats-colls=ixplatform_a,ixplatform_b --web.listen-address=:42000 --web.config=/usr/local/percona/pmm2/tmp/mongodb_exporter/agent_id/11...8a/webConfigPlaceholder

```

When I login in MongoDB as the “pmm” MongoDB user, I can also execute some of the queries I find in the exporter’s source ([https://github.com/percona/mongodb\_exporter/blob/main/exporter/indexstats\_collector.go#L90-L94](https://github.com/percona/mongodb_exporter/blob/main/exporter/indexstats_collector.go#L90-L94)):

```auto
cluster_repl_set_1 [direct: primary] test> use ixplatform_a
switched to db ixplatform_a
cluster_repl_set_1 [direct: primary] ixplatform_logs> db.collection_with_indexes.aggregate({$indexStats: {}})
[
  {
    name: 'client_public_id_1_timestamp_-1',
    key: { client_public_id: 1, timestamp: -1 },
    host: '...',
    accesses: {
      ops: Long("2215973425"),
      since: ISODate("2023-08-15T07:05:53.067Z")
    },
    spec: {
      v: 2,
      key: { client_public_id: 1, timestamp: -1 },
      name: 'client_public_id_1_timestamp_-1'
    }
  },
  {
    name: '_id_',
    key: { _id: 1 },
    host: '...',
    accesses: { ops: Long("0"), since: ISODate("2023-08-15T07:05:53.067Z") },
    spec: { v: 1, key: { _id: 1 }, name: '_id_' }
  }
]

```

What else could be wrong or is worth checking out?

---

<div class="post-metadata">

**Author:** ![nurlan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/nurlan/32/1523_2.png) [@nurlan](https://forums.percona.com/u/nurlan)\
**Post date:** [November 3, 2023, 12:58pm UTC](https://forums.percona.com/t/pmms-mongodb-dashboards-for-index-scan-ratios-and-document-scan-ratios-stay-on-no-data/26291/3 "2023-11-03T12:58:35Z")

</div>

Hi @hvtilborg , how many collections do you have? As far as I see you might not get these metrics in case you have more then 200 collections. We implemented that because it runs the query for each collection and might affect performance. If it’s the case you can re-add your service with --max-collections-limit=0 and the limit will be disabled.

---

<div class="post-metadata">

**Author:** ![hvtilborg](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/hvtilborg/32/13599_2.png) [@hvtilborg](https://forums.percona.com/u/hvtilborg)\
**Post date:** [November 3, 2023, 2:19pm UTC](https://forums.percona.com/t/pmms-mongodb-dashboards-for-index-scan-ratios-and-document-scan-ratios-stay-on-no-data/26291/4 "2023-11-03T14:19:24Z")

</div>

> [@nurlan](#):
>
> –max-collections-limit=0

Hey @nurlan , not that many:

```auto
cluster_repl_set_1 [direct: secondary] ixplatform_a> show collections
(...3 collections...)
cluster_repl_set_1 [direct: secondary] ixplatform_b> show collections
(...11 collections...)

```

I did however re-add the `mongodb` service anyway, using:

```auto
pmm-admin add mongodb --query-source=profiler --username=pmm --password=xyz --cluster=cluster-name --enable-all-collectors --stats-collections=ixplatform_a,ixplatform_b --max-collections-limit=0 -- server-name 127.0.0.1

```

And I see this reflected in the `mongodb_exporter` command arguments using `ps`:

```auto
 826197 ? Sl 2:05 /usr/local/percona/pmm2/exporters/mongodb_exporter --collector.collstats --collector.collstats-limit=0 --collector.dbstats --collector.diagnosticdata --collector.indexstats --collector.replicasetstatus --collector.topmetrics --compatible-mode --discovering-mode --log.level=warn --mongodb.collstats-colls=ixplatform_a,ixplatform_b --mongodb.global-conn-pool --mongodb.indexstats-colls=ixplatform_a,ixplatform_b --web.listen-address=:42003 --web.config=/usr/local/percona/pmm2/tmp/mongodb_exporter/agent_id/c2...71/webConfigPlaceholder

```

However, the two dashboards stay empty ☹ :

 ![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/0/0a3be742b77e9b8b1e1453aa7b23c9b045242ccf.png)

---

<div class="post-metadata">

**Author:** ![hvtilborg](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/hvtilborg/32/13599_2.png) [@hvtilborg](https://forums.percona.com/u/hvtilborg)\
**Post date:** [November 14, 2023, 2:36pm UTC](https://forums.percona.com/t/pmms-mongodb-dashboards-for-index-scan-ratios-and-document-scan-ratios-stay-on-no-data/26291/5 "2023-11-14T14:36:50Z")

</div>

Does anyone have a hint what causes these four missing graphs?

---

<div class="post-metadata">

**Author:** ![nurlan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/nurlan/32/1523_2.png) [@nurlan](https://forums.percona.com/u/nurlan)\
**Post date:** [November 15, 2023, 11:25am UTC](https://forums.percona.com/t/pmms-mongodb-dashboards-for-index-scan-ratios-and-document-scan-ratios-stay-on-no-data/26291/6 "2023-11-15T11:25:56Z")

</div>

Hi @hvtilborg,  
Could you run pmm-admin summary and check logs for mongodb\_exporter if there are anything in logs?  
Is it a cluster? if it is, which instances have you added?

---

<div class="post-metadata">

**Author:** ![hvtilborg](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/hvtilborg/32/13599_2.png) [@hvtilborg](https://forums.percona.com/u/hvtilborg)\
**Post date:** [November 16, 2023, 12:25pm UTC](https://forums.percona.com/t/pmms-mongodb-dashboards-for-index-scan-ratios-and-document-scan-ratios-stay-on-no-data/26291/7 "2023-11-16T12:25:17Z")

</div>

Hi @nurlan,

It is a cluster, not a sharded one but containing a replicaset. The cluster consists of three nodes – am04, am05, and am07 – where am05 is currently the primary. The pmm-agent is installed on all three nodes.

When I run `pmm-admin summary` on the am05, I do get this error:

```auto
[GET /logs.zip][401] Logs default &{Code:7 Error:Access denied. Message:Access denied.}
summary_am05_2023_11_16_09_33_46.zip created.

```

But the ZIP does contain the log files of the `mongodb_exporter` in `client/pmm-agent/MONGODB_EXPORTER e03e1a6f-4d1b-4298-8411-3950532f5774.log`. Here a small summary of that:

```auto
time="2023-11-07T10:20:55.456+00:00" level=error msg="time=\"2023-11-07T10:20:55Z\" level=error msg=\"Registry - Cannot get arbiterOnly to check if this is arbiter role : cannot check if the instance is an arbiter: server selection error: context canceled, current topology: { Type: Single, Servers: [{ Addr: 127.0.0.1:6317, Type: Unknown, Last error: (ShutdownInProgress) The server is in quiesce mode and will shut down },] }\"" agentID=/agent_id/e03e1a6f-4d1b-4298-8411-3950532f5774 component=agent-process type=mongodb_exporter
time="2023-11-07T10:20:55.954+00:00" level=error msg="time=\"2023-11-07T10:20:55Z\" level=error msg=\"Registry - Cannot get node type to check if this is a mongos : server selection error: context canceled, current topology: { Type: Single, Servers: [{ Addr: 127.0.0.1:6317, Type: Unknown, Last error: (ShutdownInProgress) The server is in quiesce mode and will shut down },] }\"" agentID=/agent_id/e03e1a6f-4d1b-4298-8411-3950532f5774 component=agent-process type=mongodb_exporter
time="2023-11-07T10:20:55.954+00:00" level=error msg="time=\"2023-11-07T10:20:55Z\" level=error msg=\"Registry - Cannot get arbiterOnly to check if this is arbiter role : cannot check if the instance is an arbiter: server selection error: context canceled, current topology: { Type: Single, Servers: [{ Addr: 127.0.0.1:6317, Type: Unknown, Last error: (ShutdownInProgress) The server is in quiesce mode and will shut down },] }\"" agentID=/agent_id/e03e1a6f-4d1b-4298-8411-3950532f5774 component=agent-process type=mongodb_exporter
time="2023-11-07T10:20:59.457+00:00" level=warning msg="time=\"2023-11-07T10:20:59Z\" level=warning msg=\"cannot load topology labels: cannot check if the instance is an arbiter: server selection error: server selection timeout, current topology: { Type: Single, Servers: [{ Addr: 127.0.0.1:6317, Type: Unknown, Last error: connection(127.0.0.1:6317[-75]) incomplete read of message header: read tcp 127.0.0.1:50688->127.0.0.1:6317: i/o timeout }, ] }\"" agentID=/agent_id/e03e1a6f-4d1b-4298-8411-3950532f5774 component=agent-process type=mongodb_exporter
time="2023-11-07T10:21:00.458+00:00" level=error msg="time=\"2023-11-07T10:21:00Z\" level=error msg=\"error while checking mongodb connection: server selection error: server selection timeout, current topology: { Type: Single, Servers: [{ Addr: 127.0.0.1:6317, Type: Unknown, Last error: dial tcp 127.0.0.1:6317: connect: connection refused },] }. mongo_up is set to 0\"" agentID=/agent_id/e03e1a6f-4d1b-4298-8411-3950532f5774 component=agent-process type=mongodb_exporter
time="2023-11-07T10:21:00.955+00:00" level=error msg="time=\"2023-11-07T10:21:00Z\" level=error msg=\"Registry - Cannot get node type to check if this is a mongos : server selection error: context canceled, current topology: { Type: Single, Servers: [{ Addr: 127.0.0.1:6317, Type: Unknown, Last error: dial tcp 127.0.0.1:6317: connect: connection refused },] }\"" agentID=/agent_id/e03e1a6f-4d1b-4298-8411-3950532f5774 component=agent-process type=mongodb_exporter
time="2023-11-07T10:21:00.955+00:00" level=error msg="time=\"2023-11-07T10:21:00Z\" level=error msg=\"Registry - Cannot get arbiterOnly to check if this is arbiter role : cannot check if the instance is an arbiter: server selection error: context canceled, current topology: { Type: Single, Servers: [{ Addr: 127.0.0.1:6317, Type: Unknown, Last error: dial tcp 127.0.0.1:6317: connect: connection refused },] }\"" agentID=/agent_id/e03e1a6f-4d1b-4298-8411-3950532f5774 component=agent-process type=mongodb_exporter
time="2023-11-07T10:21:01.571+00:00" level=error msg="time=\"2023-11-07T10:21:01Z\" level=error msg=\"cannot retrieve engine type: Engine is unavailable\"" agentID=/agent_id/e03e1a6f-4d1b-4298-8411-3950532f5774 component=agent-process type=mongodb_exporter

```

But looking at the date of the logs, this was around when we installed PMM on this specific node. (We interchanged two of the three nodes in the meanwhile of this topic.) There are no current `mongodb_exporter` logs.

---

<div class="post-metadata">

**Author:** ![hvtilborg](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/hvtilborg/32/13599_2.png) [@hvtilborg](https://forums.percona.com/u/hvtilborg)\
**Post date:** [December 18, 2023, 8:42am UTC](https://forums.percona.com/t/pmms-mongodb-dashboards-for-index-scan-ratios-and-document-scan-ratios-stay-on-no-data/26291/8 "2023-12-18T08:42:52Z")

</div>

I was wondering if anyone has another idea what is going wrong here.
