[SERVER-3875] Mongostats not working with Authentication enabled Created: 15/Sep/11  Updated: 11/Jul/16  Resolved: 23/Sep/11

Status: Closed
Project: Core Server
Component/s: Tools
Affects Version/s: 2.0.0
Fix Version/s: 2.0.1, 2.1.0

Type: Bug Priority: Major - P3
Reporter: Dave Jones Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 2
Labels: rn
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 10.04 on Amazon EC2


Issue Links:
Duplicate
is duplicated by SERVER-4033 the most web stats pages show error m... Closed
Related
Operating System: Linux
Participants:

 Description   

I upgraded an existing server to the 2.0 code. When authentication is enabled, I am unable to run mongostat. I get "error:
>

{ errmsg: "need to login", ok: 0.0 }

" even when using a correct username/password for an admin account. That is, I can login to admin db with the mongo cli with a given set of credentials but can not run mongostat with the same credentials.

If I turn off authentication, I'm able to run mongostat.



 Comments   
Comment by auto [ 17/Apr/12 ]

Author:

{u'login': u'monkey101', u'name': u'Daniel Pasette', u'email': u'dan@10gen.com'}

Message: SERVER-3875: Added auth() call to mongotop and fixed output formatting.
Branch: v2.0
https://github.com/mongodb/mongo/commit/a55507d21e53970d324eef2cafc653aea648b885

Comment by auto [ 25/Dec/11 ]

Author:

{u'login': u'monkey101', u'name': u'Daniel Pasette', u'email': u'dan@10gen.com'}

Message: SERVER-3875: Added auth() call to mongotop and fixed output formatting.
Branch: master
https://github.com/mongodb/mongo/commit/c8af8a123611cf88ca59e689cf8f9aa961b02ab4

Comment by auto [ 09/Oct/11 ]

Author:

{u'login': u'erh', u'name': u'Eliot Horowitz', u'email': u'eliot@10gen.com'}

Message: backport of SERVER-3875
Branch: v2.0
https://github.com/mongodb/mongo/commit/f394d2c29a3a9486039a234b51e5953dddef1874

Comment by Linux Administrators Trust HRS [ 06/Oct/11 ]

I have the same problem also with mongotop in my replica set (includes 3 members on 3 hosts, primary/secondary/arbiter).
I get the same error message in each host:

mongotop -v --host 10.94.x.x:27017 -u muser -p mpassword
Thu Oct 6 09:52:53 creating new connection to:10.94.x.x:27017
Thu Oct 6 09:52:53 BackgroundJob starting: ConnectBG
Thu Oct 6 09:52:53 connected connection!
connected to: 10.94.x.x:27017
error:

{ assertion: "unauthorized db:admin lock type:-1 client:10.94.x.x", assertionCode: 10057, errmsg: "db assertion failure", ok: 0.0 }

error:

{ assertion: "unauthorized db:admin lock type:-1 client:10.94.x.x", assertionCode: 10057, errmsg: "db assertion failure", ok: 0.0 }

Here is the output from the logfile:

Thu Oct 6 09:52:53 [initandlisten] connection accepted from 10.94.x.x:49223 #64
Thu Oct 6 09:52:54 [conn64] end connection 10.94.x.x:49223

Another question - when will the next release (2.0.1) that solves this bug be available?

Comment by auto [ 23/Sep/11 ]

Author:

{u'login': u'erh', u'name': u'Eliot', u'email': u'eliot@10gen.com'}

Message: Merge pull request #88 from guanqun/FIX-SERVER-3875

add auth() call to mongostat SERVER-3875
Branch: master
https://github.com/mongodb/mongo/commit/42a06904e7624aa3cc9962e384ebdbb91fdd33b7

Comment by auto [ 23/Sep/11 ]

Author:

{u'login': u'erh', u'name': u'Eliot', u'email': u'eliot@10gen.com'}

Message: Merge pull request #88 from guanqun/FIX-SERVER-3875

add auth() call to mongostat SERVER-3875
Branch: master
https://github.com/mongodb/mongo/commit/42a06904e7624aa3cc9962e384ebdbb91fdd33b7

Comment by Guanqun Lu [ 17/Sep/11 ]

Hi Jason,

I looked at this issue, and it seems to be a simple fix, the mongostat needs to add a 'auth' call so that it can work with authentication.

the patch is here:
https://github.com/guanqun/mongo/commit/c05baff357ff9d3e467aad7c074a85ccd81ff86a

the pull request is here:
https://github.com/mongodb/mongo/pull/88

Could you help to verify that this patch solves your problem or not? (At least it works well locally with my fix. )

Thanks!

Comment by Jason McCay [ 15/Sep/11 ]

I can confirm that we are seeing the same issue.

Generated at Thu Feb 08 03:04:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.