feat(mongodb): add version tracking modes#6243
Open
tpaskap wants to merge 2 commits into
Open
Conversation
Add version, patch-drift, and patch-status modes to monitor MongoDB patch compliance and expose them through database::mongodb::plugin. Signed-off-by: tpaskap <tpaskap@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add version, patch-drift, and patch-status modes to monitor MongoDB patch compliance and expose them through database::mongodb::plugin.
Community contributors
Description
This pull request extends the existing
database::mongodb::pluginwith three new monitoring modes focused on MongoDB version and patch compliance:version: reports the MongoDB server version and raises alerts when the instance is below configurable minimum versions (warning/critical thresholds).patch-drift: checks version consistency across replica set members, compares each member against a reference version, and detects drift between nodes.patch-status: performs auto-discovery on replica set members, compares detected versions against a branch-based patch catalogue (fixed version per MongoDB branch), and raises severity-aware alerts (NONE to CRITICAL).The custom driver was also extended to retrieve version information required by these modes.
These modes help operators reduce obsolescence exposure and detect patch drift or missing security fixes earlier in replica set environments.
Patch-status catalogues (embedded vs NVD file)
Both catalogues share the same schema (
centreon-mongodb-patch-catalog/1) but differ in detail level:$DEFAULT_CATALOGinsrc/database/mongodb/mode/patchstatus.pm--catalog-fileor--catalog-url--catalog-filenor--catalog-urlis provided--catalog-file=<path>(or--catalog-url=<url>) is providedcvesarray[]) by designfixed_versionmaxoffixed_inper branch)Each branch entry in both catalogues contains the same top-level fields:
{ "branch": "6.0", "vulnerable_range": { "min_inclusive": "6.0.0", "max_exclusive": "6.0.28" }, "fixed_version": "6.0.28", "default_severity": "HIGH", "cves": [ ... ] }When browsing an external catalogue JSON file, the
cvesarray is long and appears first in pretty-printed output, which can make the file look different from the embedded catalogue. Scroll within the same branch object (or inspect withjq) to seefixed_version,vulnerable_range, anddefault_severity.How
patch-statususes them:--catalog-file): compares the member version against eachfixed_inincves[]and counts outstanding CVEs.fixed_version+default_severitywhen the running version is below the branch fix.Recommended usage:
--catalog-file(embedded catalogue).--catalog-file=<path-to>/mongodb-patch-catalog.json(or--catalog-url=<url>).Fixes # (issue)
Type of change
How this pull request can be tested ?
Prerequisites
database::mongodb::plugin(libmongodb-perl, etc.)patch-statuswith CVE-level detail: a local JSON catalogue file conforming to schemacentreon-mongodb-patch-catalog/1. Without it, the mode falls back to the embedded default catalogue inpatchstatus.pm.1. List the new modes
Expected:
version,patch-drift, andpatch-statusappear in the mode list.2. Test
versionon a single instanceExpected: plugin output shows the MongoDB version and returns OK/WARNING/CRITICAL according to thresholds.
3. Test
patch-drifton a replica setExpected: one status line per member, with reference version and drift information.
4a. Test
patch-statuswith the embedded default catalogue (no--catalog-file)Expected: auto-discovery of members, comparison against the hard-coded branch
fixed_version(no per-CVE detail). Debug output includesUsing built-in default patch catalog.4b. Test
patch-statuswith the NVD catalogue file (recommended for production)Expected: auto-discovery of members, comparison against branch
fixed_version, and severity-aware status based on outstanding CVEs listed in the catalogue.Example (anonymized replica set, NVD catalogue,
--debug)Command:
Sample output (all members patched on branch 6.0):
To inspect the catalogue structure (same schema as the embedded default, with populated
cves):Sample output:
{ "branch": "5.0", "fixed_version": "5.0.33", "default_severity": "HIGH", "cve_count": 15 } { "branch": "6.0", "fixed_version": "6.0.28", "default_severity": "HIGH", "cve_count": 25 } { "branch": "7.0", "fixed_version": "7.0.35", "default_severity": "HIGH", "cve_count": 41 } { "branch": "8.0", "fixed_version": "8.0.24", "default_severity": "HIGH", "cve_count": 35 }Collection type: CLI (command + output).
Checklist