Details

    • Type: Bug
    • Status: Done
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.6.0
    • Component/s: PMM Client
    • Labels:
      None
    • Story Points:
      2

      Description

      Consider 3 databases [a,b,c].

      pmm-admin add mongodb --uri mongodb://admin:admin@localhost:27017/?authSource=admin_db

       Above command will authenticate all 3 databases to admin_db database.

      pmm-admin add mongodb --uri mongodb://admin:admin@localhost:27017
      pmm-admin add mongodb --uri mongodb://admin:admin@localhost:27017/admin_db

      Both above commands will authenticate:

      • to a through a
      • to b through b
      • to c through c

      I think this is not correct behavior and not user friendly. My proposal.

      pmm-admin add mongodb --uri mongodb://admin:admin@localhost:27017
      

      Above command will authenticate all 3 databases to default `admin` database.

      pmm-admin add mongodb --uri mongodb://admin:admin@localhost:27017/admin_db
      pmm-admin add mongodb --uri mongodb://admin:admin@localhost:27017/?authSource=admin_db

      All above commands will authenticate all 3 databases to admin_db database.

      I think this is more in sync with MongoDB documentation.
      https://github.com/mongodb/docs/blob/99b70277c13d45f6d4177ec8c37a1df6714f6522/source/reference/connection-string.txt#L84-L92

      /database 	Optional. The name of the database to authenticate if the connection string includes authentication credentials in the form of username:password@. If /database is not specified and the connection string includes credentials, the driver will authenticate to the admin database.
      

      https://docs.mongodb.com/manual/reference/connection-string/#urioption.authSource

      Specify the database name associated with the user’s credentials. authSource defaults to the database specified in the connection string.
      
      For authentication mechanisms that delegate credential storage to other services, the authSource value should be $external as with the PLAIN (LDAP) and GSSAPI (Kerberos) authentication mechanisms.
      
      MongoDB will ignore authSource values if the connection string specifies no username.
      

      I think it should be also more user friendly as simple:

      pmm-admin add mongodb --uri mongodb://admin:admin@localhost:27017

      ... should setup monitoring for MongoDB server that is using default `admin` database for auth.

        Smart Checklist

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  kamil.dziedzic Kamil Dziedzic (Inactive)
                • Votes:
                  1 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: