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 |
|
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'.