How can I get collstats for all namespaces using mongodb exporter?

Hello, I’m trying to collect collstats using mongodb exporter.
However, the --mongodb.collstats-colls option only seems to work when I provide the exact namespace, and it doesn’t work when I only provide the database name.

--mongodb.collstats-colls=* (not working)
--mongodb.collstats-colls=testdb (not working)
--mongodb.collstats-colls=testdb.testcol (working)

Due to the dynamic nature of our service with frequent database additions and deletions, I would like to collect collstats for all namespaces without explicitly listing them in the option.
If that’s not possible, I’d like to collect collstats for all collections within a database when I only list the database name.

Could you provide guidance on how to achieve this?
Thank you.

Hi @illa0421c ,

Welcome to the Percona Community !!
Try using the discovery mode along with collstats and check it.

--discovering-mode --mongodb.collstats-colls=your_db_name


Or, try with just --collector.collstats which enables collecting metrics from $collStats.


Hi @Parag_Bhayani ,
Following your guidance, I provided the options you mentioned, and I confirmed that it collects collstats for all databases without specifying the namespace.

--collector.collstats --discovering-mode

Thank you for your help.

Best Regards,