Explore the latest product updates and best practices at our hybrid Checkmk Conference #12 from June 16-18, 2026 – Register here

Werk #18487: mk_mongodb: add support for recent mongodb versions in sharded environments

Component Checks & agents
Title mk_mongodb: add support for recent mongodb versions in sharded environments
Date Apr 1, 2026
Level Trivial Change
Class Bug Fix
Compatibility Compatible - no manual interaction needed
Checkmk versions & editions
2.6.0b1
Not yet released
Checkmk Community, Checkmk Pro, Checkmk Ultimate, Checkmk Cloud, Checkmk Ultimate MT
2.5.0p2
Not yet released
Checkmk Community, Checkmk Pro, Checkmk Ultimate, Checkmk Cloud, Checkmk Ultimate MT
2.4.0p29
Not yet released
Checkmk Community, Checkmk Pro, Checkmk Ultimate, Checkmk Cloud, Checkmk Ultimate MT

The previous version of mk_mongodb crashed with a stacktrace similar to the one below when connected to a sharded MongoDB cluster in version 5.0 or above where chunks are distributed across more than one shard:

  File ".../share/check_mk/agents/plugins/mk_mongodb.py", line 530, in _count_chunks_per_shard
    database_name, collection_name = _split_namespace(chunk.get("ns"))
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../share/check_mk/agents/plugins/mk_mongodb.py", line 579, in _split_namespace
    raise ValueError("error parsing namespace %s" % namespace)
ValueError: error parsing namespace None

This was caused by MongoDB 5 changing the internal data format of the chunks collection.

Two other bugs were also fixed:

It was possible that the MongoDB check crashed with TypeError: object of type 'int' has no len()

And the mk_mongodb agent plugin could crash with 'NoneType' object has no attribute 'get'.

To the list of all Werks