Uploaded image for project: 'Percona Monitoring and Management'
  1. Percona Monitoring and Management
  2. PMM-4906

The MongoDB exporter for MongoDB 4.0 and above was causing a "log bloat" condition.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Low
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.6.0
    • Component/s: MongoDB_Exporter
    • Labels:
      None
    • Story Points:
      0
    • Sprint:
      Platform Sprint 9, Platform Sprint 10, Platform Sprint 11, Platform Sprint 14
    • Needs Review:
      Yes
    • Needs QA:
      Yes
    • Needs Packaging:
      No
    • Needs Doc:
      No

      Description

      Low-priority log bloat issue.

      In 4.0 an "authorizedCollections" option was added to the listCollections command. In mongodb_exporter this server command is is used whenever a collector iterates all collections (e.g. in the collection_status.go and indexusage.go files).

      Since then (or possibly only since 4.2, I haven't confirmed 4.0) attempting to run the following command in the "admin" db as the "clusterMonitor" role-granted user that mongodb_exporter uses causes an authorization error and a message in the log every time the collector runs.

      db.adminCommand({"listCollections": 1, "nameOnly": 1})
      

      It is just the "admin" db. So only one log line per collection.

      It is not a permissions issue because "clusterMonitor" is the only suitable built-in role for mongodb_exporter to use.

      The fix is to add the "authorizedCollections" option as well.

      db.adminCommand({"listCollections": 1, "nameOnly": 1, "authorizedCollections": true})
      

      The above is just how it is represented as mongo shell code; the actual mongodb_exporter code is go is currently lines like this:

      c, err := client.Database(db).ListCollections(context.TODO(), bson.M{}, options.ListCollections().SetNameOnly(true))
      

      DOC: since this is an exporter change, it will not affect PMM Documentation for now. But if needed Exporter documentation can be changed

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            akira.kurogane Akira Kurogane
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Smart Checklist