<!-- llms-explorer concept facts · https://llms-explorer.com/tree/persisting-index-usage-metrics-with-pmm-and-mongodb-exporter/ · pack 2026-10-31 · ~1705 tokens -->

# Persisting index usage metrics with PMM and mongodb_exporter

> Source-anchored research for Persisting index usage metrics with PMM and mongodb_exporter. Run status: COMPLETED.

Parent: [Unused index detection with $indexStats](https://llms-explorer.com/tree/unused-index-detection-with-indexstats/) · 6 facets · 17 facts · page: https://llms-explorer.com/tree/persisting-index-usage-metrics-with-pmm-and-mongodb-exporter/

## How it works

- Methodological inference: do not classify absent index telemetry as zero use. A Percona support thread documents a missing metric when its collector is disabled; Prometheus absent_over_time() explicitly detects an interval without samples. (medium confidence) — [source](https://forums.percona.com/t/view-index-usage/26802)

## How-to and procedures

- Set metrics retention to cover the complete application workload cycle before treating inactivity as evidence for removal. Percona explicitly warns about indexes used by monthly reports; retaining less than the relevant cycle can miss their use. (high confidence) — [source](https://www.percona.com/blog/identifying-unused-indexes-in-mongodb/)

## Measurements and reference values

- For PMM 3, the documented Change Settings API uses PUT /v1/server/settings with data_retention expressed in seconds; the 30-day example is "2592000s", and hour or minute formats are documented as errors. (low confidence) (verified as of 2026-10-26) — [source](https://docs.percona.com/percona-monitoring-and-management/3/configure-pmm/advanced_settings.html)

## Problems, failure modes and limitations

- Absence of index metrics is not proof of zero accesses. The PMM 2 command reference says exceeding the configured collection limit stops collStats/indexStats collection; exporter issue #792 contains indexStats authorization and timeout errors. Validate collection coverage and scrape health before making a removal decision. (medium confidence) — [source](https://docs.percona.com/percona-monitoring-and-management/2/details/commands/pmm-admin.html)
- Methodological inference: retained metrics cannot establish unobserved activity. Review collection gaps and counter reset boundaries before treating a zero estimated increase as evidence for removal. (medium confidence) — [source](https://prometheus.io/docs/prometheus/latest/querying/functions/)

## Comparisons and alternatives

- In the May 2024 missing-metrics thread, a responder suggested insufficient permissions, but the user said the documented permissions were present and the thread showed no confirmed resolution. This is a diagnostic lead rather than proof that permissions caused that incident. (low confidence) — [source](https://forums.percona.com/t/unable-to-see-mongodb-dbstats-collstats-and-indexstats-metrics/30145)

## Facts and statements

- PMM can retain sampled index-access history after a monitored mongod restarts. MongoDB resets its live index statistics on restart; retaining samples does not make the database counter persistent or reconstruct activity before monitoring began. (high confidence) — [source](https://www.percona.com/blog/identifying-unused-indexes-in-mongodb/)
- The PMM 2 configuration documentation states a default time-series retention of 30 days and allows adjustment for available disk space and history requirements. This is a PMM 2 documented default, not a verified default for every PMM release. (low confidence) (verified as of 2026-10-30) — [source](https://docs.percona.com/percona-monitoring-and-management/2/how-to/configure.html)
- A December 2023 PMM 2.40.1 forum answer identifies mongodb_indexstats_accesses_ops as the index-access series. It explains that indexstats requires explicit collector enablement; the PMM 2 command reference documents --enable-all-collectors and namespace selection with --stats-collections. (medium confidence) (verified as of 2023-12-04) — [source](https://forums.percona.com/t/view-index-usage/26802)
- Index-usage observations are local to the node serving the request. Preserve node identity in historical series and inspect every node that serves application reads before interpreting an index as unused across a deployment. (high confidence) — [source](https://www.mongodb.com/docs/v8.0/reference/operator/aggregation/indexstats/)
- MongoDB documents that index statistics reset on restart, index drop and recreation, or modification with collMod. Inference for historical review: retain index identity and lifecycle context so a newly reset or recreated index is not interpreted as continuously unused. (low confidence) — [source](https://www.mongodb.com/docs/v8.0/reference/operator/aggregation/indexstats/)
- For a cumulative access series, Prometheus increase() adjusts observed counter resets and extrapolates over the selected range; rate() produces a per-second average. Inference: summing raw counter samples is not an access count. Validate the deployed exporter series semantics and the PMM query engine before applying this pattern. (medium confidence) — [source](https://prometheus.io/docs/prometheus/latest/querying/functions/)
- Treat old dashboard queries as version-dependent: the exporter changelog records indexstats metric-naming changes in release 0.31.0, and the README describes --compatible-mode for legacy metric names. A 2018 PMM blog command is historical setup evidence, not a current universal command. (medium confidence) — [source](https://github.com/percona/mongodb_exporter/blob/main/CHANGELOG)
- PMM 3 documentation states that time-series retention defaults to 30 days and can be adjusted to balance history requirements against available disk space. (low confidence) (verified as of 2026-10-26) — [source](https://docs.percona.com/percona-monitoring-and-management/3/configure-pmm/advanced_settings.html)
- Treat index changes as observation boundaries: MongoDB resets statistics after index drop and recreation or modification through collMod. Saving historical samples does not make the live counter continuous across those events. (medium confidence) — [source](https://www.mongodb.com/docs/v8.0/reference/operator/aggregation/indexstats/)
- Prometheus increase() adjusts observed counter decreases as resets and extrapolates across the requested interval, so its result can be fractional. Apply it only to a confirmed counter-like series; this documents Prometheus semantics, not a verified PMM dashboard query. (low confidence) — [source](https://prometheus.io/docs/prometheus/latest/querying/functions/)
- Zero user-access counts do not demonstrate that an index has no operational role: MongoDB excludes internal work such as TTL deletions, and Percona notes that uniqueness checks on inserts do not increment the usage counter. (high confidence) — [source](https://www.mongodb.com/docs/v8.0/reference/operator/aggregation/indexstats/)
