Ad Widget

Collapse

Mongodb template not supporting --authenticationDatabase parameter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zabbix-peter
    Junior Member
    • Nov 2024
    • 12

    #1

    Mongodb template not supporting --authenticationDatabase parameter

    I am trying to deploy monitoring of our Mongodb environment and are strugling to get it working.

    The following works, to login to the CLI:

    Code:
    mongodb01:~# mongo -u zabbix_read -p zREDACTEDJ --authenticationDatabase admin
    MongoDB shell version v3.6.3
    connecting to: mongodb://127.0.0.1:27017
    MongoDB server version: 3.6.3
    prodrs0:SECONDARY> quit
    This does not work:

    Code:
    mongodb01:~# mongo -u zabbix_read -p zREDACTEDJ
    MongoDB shell version v3.6.3
    connecting to: mongodb://127.0.0.1:27017
    MongoDB server version: 3.6.3
    2025-09-22T09:07:24.078+0200 E QUERY    [thread1] Error: Authentication failed. :
    DB.prototype._authOrThrow@src/mongo/shell/db.js:1608:20
    @(auth):6:1
    @(auth):1:2
    exception: login failed​
    I must use parameter --authenticationDatabase admin to succesfully login.
    The templates i use to monitor, or at least try, do not support a authenticationDatabase.
    Therefore, i cannot get information about the database and thus not monitor the internals.

    Template versions are:
    - 7.4-0 MongoDB cluster by Zabbix agent 2​
    - 7.4-0 MongoDB node by Zabbix agent 2​

    My Zabbix version is 7.4.2

    I was thinking to pass a parameter for this in my mongodb.conf, zabbix_agent2 plugin, but do not know how to do this or if it is even possible.

    Code:
    Plugins.MongoDB.Sessions.REDACTEDMongoDB.Uri=tcp://localhost:27017
    Plugins.MongoDB.Sessions.REDACTEDMongoDB.User=admin/zabbix_read
    Plugins.MongoDB.Sessions.REDACTEDMongoDB.Password=zREDACTEDJ​
    Is there a workaround or another solution to this.

    Thank you for your attention.
    Input is greatly appreciated.

    Regards, Peter.

  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    have you tried to specify that session uri as "tcp://localhost:27017/?authSource=admin"

    I just poked around in mongodb docs a bit... Not much of a mongo user myself..
    Use connection strings to establish connections between MongoDB instances, tools, and applications that use drivers.

    Comment


    • zabbix-peter
      zabbix-peter commented
      Editing a comment
      I have tried that, but it did not work.
      Besides that, the documentation states; "Should not include embedded credentials (they will be ignored)."
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #3
    I did not mean to embed credentials... There are config fields for those in plugin config. Just URI part... But if you tried, then There should be someother way... recreating that user in each DB instead of just admin?

    Comment

    • zabbix-peter
      Junior Member
      • Nov 2024
      • 12

      #4
      I need to hear with the DBA about adding the ro_user to all the provisoned databases.
      Thanks for answering.

      Any tips are welcome.

      Comment

      • cyber
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2006
        • 4807

        #5
        It is starting to feel, like plugin works against common practices... Maybe needs an update, You can submit a feature request..:P

        Comment

        Working...