Page 1 of 1

check_mongodb.py connection failure

Posted: Tue Jan 14, 2025 12:30 pm
by ksafa
Hello All,
I'm attempting to use check_mongodb.py script and its failing on initial connection test. Destination server is up and port is accessible via netcat. The error is below:

./check_mongodb.py -H X.X.X.X -P 27017
CRITICAL - Connection to Mongo server on X.X.X.X:27017 has failed

Error is not very informative. Any ideas on what I may be missing?

Thanks

Re: check_mongodb.py connection failure

Posted: Tue Jan 14, 2025 3:47 pm
by jmichaelson
Hi @ksafa,

Can you go to a shell prompt and execute the following:

Code: Select all

pip show pymongo
And post the output here?

Re: check_mongodb.py connection failure

Posted: Tue Jan 14, 2025 3:47 pm
by lgute
Hi @ksafa,

Are you providing username and password? Something like this...

Code: Select all

./check_mongodb.py -H x.x.x.x -P port -u USER -p PASSWD

Re: check_mongodb.py connection failure

Posted: Tue Jan 14, 2025 4:24 pm
by ksafa
Made some more progress. It seems the error in the Mongo logs is "SSLHandshakeFailed" "The server is configured to only allow SSL connections". When I attempted to add ssl parameters to command i received following error (also not sure if my syntax is off):

./check_mongodb.py -H X.X.X.X -P 27017 -u USER -p PASSWD --ssl --ssl-ca-cert-file=/path/to/cert.pem
CRITICAL - General MongoDB Error: Unknown option ssl_cert_reqs

I was reading somewhere about ssl_cert_reqs being deprecated in pymongo 3.9. I'm currently running 4.3.3. Is there an updated check_mongodb.py that uses tls instead of ssl ?

#pip3.9 show pymongo
Name: pymongo
Version: 4.3.3
Summary: Python driver for MongoDB <http://www.mongodb.org>
Home-page: http://github.com/mongodb/mongo-python-driver
Author: The MongoDB Python Team
Author-email:
License: Apache License, Version 2.0
Location: /usr/lib64/python3.9/site-packages/pymongo-4.3.3-py3.9-linux-x86_64.egg
Requires: dnspython
Required-by:

Re: check_mongodb.py connection failure

Posted: Tue Jan 14, 2025 5:04 pm
by sgardil
ksafa wrote: Tue Jan 14, 2025 4:24 pm Made some more progress. It seems the error in the Mongo logs is "SSLHandshakeFailed" "The server is configured to only allow SSL connections". When I attempted to add ssl parameters to command i received following error (also not sure if my syntax is off):

./check_mongodb.py -H X.X.X.X -P 27017 -u USER -p PASSWD --ssl --ssl-ca-cert-file=/path/to/cert.pem
CRITICAL - General MongoDB Error: Unknown option ssl_cert_reqs

I was reading somewhere about ssl_cert_reqs being deprecated in pymongo 3.9. I'm currently running 4.3.3. Is there an updated check_mongodb.py that uses tls instead of ssl ?

#pip3.9 show pymongo
Name: pymongo
Version: 4.3.3
Summary: Python driver for MongoDB <http://www.mongodb.org>
Home-page: http://github.com/mongodb/mongo-python-driver
Author: The MongoDB Python Team
Author-email:
License: Apache License, Version 2.0
Location: /usr/lib64/python3.9/site-packages/pymongo-4.3.3-py3.9-linux-x86_64.egg
Requires: dnspython
Required-by:
Hey @ksafa

Unfortunately it looks like we don't have an updated version currently that uses tls instead of ssl. I will open up a ticket for a feature request to add this.

Re: check_mongodb.py connection failure

Posted: Thu Jan 16, 2025 9:11 am
by ksafa
Do you know what the turn around time will be on such a request?

Thank you

Re: check_mongodb.py connection failure

Posted: Fri Jan 17, 2025 11:13 am
by lgute
Hi @ksafa,

We do not have access to when issues are scheduled for development. You can keep an eye out in the CHANGELOG for the tag [GL:XI#1438].