Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not authorized on admin to execute command #36

Open
silveraignacio opened this issue Sep 10, 2020 · 1 comment
Open

not authorized on admin to execute command #36

silveraignacio opened this issue Sep 10, 2020 · 1 comment

Comments

@silveraignacio
Copy link

Hello! I'm fightin with this issue since many months ago. I have configured the user admin with its respective password, but I'm getting the following issue:

Traceback (most recent call last):
File "/etc/zabbix/zabbix-mongodb/bin/zabbix-mongodb.py", line 246, in
mongodb.get_maintenance()
File "/etc/zabbix/zabbix-mongodb/bin/zabbix-mongodb.py", line 137, in get_maintenance
fsync_locked = int(db_handler.is_locked)
File "/usr/local/lib64/python3.6/site-packages/pymongo/mongo_client.py", line 2090, in is_locked
ops = self._database_default_options('admin')._current_op()
File "/usr/local/lib64/python3.6/site-packages/pymongo/database.py", line 989, in _current_op
session=session)
File "/usr/local/lib64/python3.6/site-packages/pymongo/database.py", line 630, in _command
client=self.__client)
File "/usr/local/lib64/python3.6/site-packages/pymongo/pool.py", line 613, in command
user_fields=user_fields)
File "/usr/local/lib64/python3.6/site-packages/pymongo/network.py", line 167, in command
parse_write_concern_error=parse_write_concern_error)
File "/usr/local/lib64/python3.6/site-packages/pymongo/helpers.py", line 159, in _check_command_response
raise OperationFailure(msg % errmsg, code, response)
pymongo.errors.OperationFailure: not authorized on admin to execute command { currentOp: 1, $all: false, lsid: { id: UUID("1c919a5b-589b-4b64-90d3-04d38bcdc0e7") }, $clusterTime: { clusterTime: Timestamp(1599752794, 1), signature: { hash: BinData(0, 9D55DD66DF85C2AC42A4D3DBEF6320004F311DAD), keyId: 6819303971690119172 } }, $db: "admin", $readPreference: { mode: "primary" } }

The weird here is i'm accessing mongo db as admin user, so I cannot understand why it haven't got permission to get currentOp.

MongoDB shell version v4.2.6
git version: 20364840b8f1af16917e4c23c1b5f5efd8b352f8
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
allocator: tcmalloc
modules: none
build environment:
distmod: rhel70
distarch: x86_64
target_arch: x86_64

zabbix_agentd (daemon) (Zabbix) 4.0.19
Revision a566532084 23 March 2020, compilation time: Mar 23 2020 10:21:27

Copyright (C) 2020 Zabbix SIA
License GPLv2+: GNU GPL version 2 or later http://gnu.org/licenses/gpl.html.
This is free software: you are free to change and redistribute it according to
the license. There is NO WARRANTY, to the extent permitted by law.

This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (http://www.openssl.org/).

Compiled with OpenSSL 1.0.1e-fips 11 Feb 2013
Running with OpenSSL 1.0.1e-fips 11 Feb 2013

Can anyone help me?

Thanks!

@rams007
Copy link

rams007 commented May 13, 2021

you need create mongodb user with root priveleges

db.createUser(
  {
    user: 'admin',
    pwd: 'password',
    roles: [ { role: 'root', db: 'admin' } ]
  }
);

like this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants