Open javadan opened 5 years ago
Just for your info: We are using this plugin (maybe not the most recent version) with mongodb v4 and authentication without any problems. What do you want to achieve with this plugin? Adding users?
In my case, we are using this plugin with mongoDB 4, auth SCRAM-SHA-256 and ssl certs without problems. If you have problems with root just add a new user and give a try with that new one
I have mongodb v4 with authentication enabled but no ssl, and the error is mechanism must be in ('MONGODB-CR', 'GSSAPI')
Hi @kagahd,
how are you using this?
I am trying to connect to MongoDB 4.2.3 with that latest version of this scheck plugin using ./check_mongodb -H $host -P $port -D -u root -p $root_pass -a admin -A connect
.. I am getting the error "Username/Password incorrect
" whatever combination of options I try (e.g. -m SCRAM-SHA-256
).
The connection from commandline using this data/credentials works, and that user is defined as:
{
"_id" : "admin.root",
"userId" : UUID("a3acd8be-ca1f-41cc-eee2-0b025315f0"),
"user" : "root",
"db" : "admin",
"roles" : [
{
"role" : "root",
"db" : "admin"
}
],
"mechanisms" : [
"SCRAM-SHA-1",
"SCRAM-SHA-256"
]
}
Thanks!
Hi @whatyoudoiswhatyouare,
we are calling it like this for example:
./check_mongo.py -H $HOST -P 27017 -u myuser -p$PASSWORD -A$ACTION -W$WARNING -C$CRITICAL
Our mongodb version is 4.0.6
The credentials for our myuser
user look as follows:
{
"_id" : "admin.myuser",
"user" : "myuser",
"db" : "admin",
"roles" : [
{
"role" : "root",
"db" : "admin"
}
]
}
Have you tried upgrading pymongo? Worked for me
pip install pymongo --upgrade
did the trick after moving von 4.0 to 4.2 on mongodb side
Have you tried upgrading pymongo? Worked for me
pip install pymongo --upgrade
did the trick after moving von 4.0 to 4.2 on mongodb side
thanks that resolve my issue
Hi,
I'm using standard percona mongodb in Centos7 server
[root@livechat-cti1 plugins]# rpm -qa | grep mongo | grep percona
percona-server-mongodb-server-4.4.1-3.el7.x86_64
percona-server-mongodb-mongos-4.4.1-3.el7.x86_64
percona-server-mongodb-shell-4.4.1-3.el7.x86_64
percona-server-mongodb-4.4.1-3.el7.x86_64
percona-server-mongodb-tools-4.4.1-3.el7.x86_64
[root@livechat-cti1 plugins]#
And this is the centos7 version:
[root@livechat-cti1 plugins]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@livechat-cti1 plugins]#
I installed the python-pymongo package from the EPEL repository:
[root@livechat-cti1 plugins]# rpm -qa | grep python-pymongo
python-pymongo-2.5.2-5.el7.x86_64
[root@livechat-cti1 plugins]#
this is the mongo client correct connection (only connect and exit):
[root@livechat-cti1 plugins]# mongo --port 47017 --authenticationDatabase admin --username dba --password $password
Percona Server for MongoDB shell version v4.4.1-3
connecting to: mongodb://127.0.0.1:47017/?authSource=admin&compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("fedc85fb-e881-434c-acee-fbdf18ea5131") }
Percona Server for MongoDB server version: v4.4.1-3
---
The server generated these startup warnings when booting:
2020-11-02T10:41:19.289+01:00: ***** SERVER RESTARTED *****
---
> exit
bye
and this is the plugin output:
[root@livechat-cti1 plugins]# check_mongodb.py -H localhost -P 47017 -a admin -u dba -p $password
Username/Password incorrect
[root@livechat-cti1 plugins]#
Am I doing something wrong?
Hi,
I'm using standard percona mongodb in Centos7 server
[root@livechat-cti1 plugins]# rpm -qa | grep mongo | grep percona percona-server-mongodb-server-4.4.1-3.el7.x86_64 percona-server-mongodb-mongos-4.4.1-3.el7.x86_64 percona-server-mongodb-shell-4.4.1-3.el7.x86_64 percona-server-mongodb-4.4.1-3.el7.x86_64 percona-server-mongodb-tools-4.4.1-3.el7.x86_64 [root@livechat-cti1 plugins]#
And this is the centos7 version:
[root@livechat-cti1 plugins]# cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core) [root@livechat-cti1 plugins]#
I installed the python-pymongo package from the EPEL repository:
[root@livechat-cti1 plugins]# rpm -qa | grep python-pymongo python-pymongo-2.5.2-5.el7.x86_64 [root@livechat-cti1 plugins]#
this is the mongo client correct connection (only connect and exit):
[root@livechat-cti1 plugins]# mongo --port 47017 --authenticationDatabase admin --username dba --password $password Percona Server for MongoDB shell version v4.4.1-3 connecting to: mongodb://127.0.0.1:47017/?authSource=admin&compressors=disabled&gssapiServiceName=mongodb Implicit session: session { "id" : UUID("fedc85fb-e881-434c-acee-fbdf18ea5131") } Percona Server for MongoDB server version: v4.4.1-3 --- The server generated these startup warnings when booting: 2020-11-02T10:41:19.289+01:00: ***** SERVER RESTARTED ***** --- > exit bye
and this is the plugin output:
[root@livechat-cti1 plugins]# check_mongodb.py -H localhost -P 47017 -a admin -u dba -p $password Username/Password incorrect [root@livechat-cti1 plugins]#
Am I doing something wrong?
I had de same issue, the problem was the repository version of pymongo. Remove the package python-pymongo, install pip and then use pip install pymongo
from this one response https://github.com/mzupan/nagios-plugin-mongodb/issues/243#issuecomment-596511885, that should fix your problem
upgrading pymongo with git is outside the package manager and will cause problems later on. Are there repos out there with a newer pymongo?
@ekollof I know it's an old issue, but the best practices with Python packages is to create a virtualenv, so it doesn't affect your system libraries.
Should be something like:
python3 -m venv /path/to/venv
. /path/to/venv/bin/activate
pip install pymongo
You will probably have to change de shebang of the script to /path/to/venv/bin/python
, or make sure to activate the virtualenv prior to running the script
Hi,
I just tried setting up this plugin for monitoring MongoDB 4, and I get authentication errors. I use the root ('root' privileges) username and password, and it says "Invalid Username / Password" though the credentials work for using mongo on the command line.
I tried quotes and doublequotes, and downgrading to auth schema 3, as per issue #170 , But MongoDB 4 complains:
Error: couldn't add user: User and role management commands require auth data to have at least schema version 5 but found 3
So I'm stuck, My best guess is that it is trying to use the MongoDB-CR auth method, which was removed in MongoDB 4. I've tried specifying the auth mechanism, with -m, and pretty much everything.
If I look at the root user, they have clusterAdmin rights, plus a SCRAM-SHA-1 and SCRAM-SHA-256 password stored.
Is there a workaround or solution for using the plugin with MongoDB 4?
Thanks Dan