MongoDB Database Monitoring

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

MongoDB Database Monitoring

Post by jkinning »

I am still trying to get monitoring going for some external MongoDB databases. I had our firewall guys open up the necessary ports and I appear to be able to connect now but getting Username/Password incorrect and I know they are right.

Code: Select all

./check_mongodb.py -H ds028797-a1.krf74.fleet.mongolab.com -P 12345 -u username_masked -p password_masked -d mc-5940133d-bf07-4545-a704-ef49d24e8a1a-trackingcontact
Username/Password incorrect
From what I can tell I am using the correct syntax. Not sure what to try next.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: MongoDB Database Monitoring

Post by npolovenko »

Hello, @jkinning. Are there any special characters used in the password? If so, please put the password in single quotes. What version of mongoDB are you running?
Try to nmap the mongoDB port from the Nagios server:

Code: Select all

nmap ds028797-a1.krf74.fleet.mongolab.com -p1235
Make sure that authentication is enabled on MongoDB server https://docs.mongodb.com/manual/tutoria ... ntication/
Also, you may be able to find some more information on what exactly goes wrong in mongodb log file.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: MongoDB Database Monitoring

Post by jkinning »

I am still struggling to get this to work.

Here is what the logs show:

Code: Select all

2018-01-11T11:23:24.664-0800 I NETWORK  [initandlisten] connection accepted from 207.242.44.6:11122 #51743 (11 connections now open)
2018-01-11T11:23:24.744-0800 I NETWORK  [initandlisten] connection accepted from 207.242.44.6:11143 #51744 (12 connections now open)
2018-01-11T11:23:24.792-0800 I ACCESS   [conn51744] SCRAM-SHA-1 authentication failed for scadmin on admin from client 207.242.44.6 ; UserNotFound Could not find user scadmin@admin
2018-01-11T11:23:24.815-0800 I NETWORK  [conn51744] end connection 207.242.44.6:11143 (11 connections now open)
2018-01-11T11:23:24.815-0800 I NETWORK  [conn51743] end connection 207.242.44.6:11122 (10 connections now open)
When the Developer is testing this with Robo3t here is what his settings are, pic1,pic2, and pic3.

When I validate with nmap things look alright:

Code: Select all

nmap ds038327-a1.krf74.fleet.mongolab.com -p38322

Starting Nmap 6.47 ( http://nmap.org ) at 2018-01-12 07:49 EST
Nmap scan report for ds038327-a1.krf74.fleet.mongolab.com (52.170.221.52)
Host is up (0.0031s latency).
PORT      STATE SERVICE
38322/tcp open  unknown

Nmap done: 1 IP address (1 host up) scanned in 0.34 seconds
But when I try to run from Nagios I get the same thing.

Code: Select all

./check_mongodb.py -H ds028797-a1.krf74.fleet.mongolab.com -P 12345 -u username_masked -p password_masked -d mc-5940133d-bf07-4545-a704-ef49d24e8a1a-trackingcontact
Username/Password incorrect
You do not have the required permissions to view the files attached to this post.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: MongoDB Database Monitoring

Post by npolovenko »

@jkinning, Can you try using the plugin in the attachment instead? Does it fix the issue?
Also, I'd try to put single quotes around the username and, maybe the password as well.
SCRAM-SHA-1 authentication failed for scadmin on admin from client 207.242.44.6 ; UserNotFound Could not find user scadmin@admin
Was this line taken from a MongoDB server-side log?It says it couldn't find the username "scadmin@admin". But whenever you test the connection with this username everything works as it should, right?
You do not have the required permissions to view the files attached to this post.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: MongoDB Database Monitoring

Post by jkinning »

I am using the new check_mongodb.pl script you provide and still get the same problem.

Yes when using Robo3t we are able to connect to the instance. I even tried to use the username@instance but still the same result.
You do not have the required permissions to view the files attached to this post.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: MongoDB Database Monitoring

Post by npolovenko »

@jkinning, It could be an authentication mechanism issue. I think MONGODB-CR used to be a default authentication method for MongoDB until recently, and now its CRAM-CHA. I will try to spin up a MongoDB server in the lab in the next couple of days. But in a meantime, you could always ask the author of this plugin directly on a Github page, and I believe he also left his email address for questions.
https://github.com/mzupan/nagios-plugin-mongodb
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: MongoDB Database Monitoring

Post by jkinning »

I've reached out to the plugin author via email but just hearing crickets.

You get a chance to test this in your lab?
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: MongoDB Database Monitoring

Post by npolovenko »

@jkinning, I tested out this plugin with my own instance of MongoDB hosted on the mlab. And I've got exactly the same error you had. So I went ahead and submitted an internal bug report. You may be able to find another, working plugin on the Nagios Exchange while they release a fix for this one. https://exchange.nagios.org/index.php?o ... rd=mongodb
Thank you.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: MongoDB Database Monitoring

Post by jkinning »

I looked over the list and tried out a couple but couldn't find one where I can specify a different port.

I have tried these:

Code: Select all

https://exchange.nagios.org/directory/Plugins/Databases/Others/Check-MongoDB/details

Code: Select all

https://tag1consulting.com/blog/mongodb-nagios-check
this one I couldn't get much going, disclaimer I am not a MongoDB expert, so when I got it installed and tried different commands based of the syntax on the site I kept getting this message.
./check_mongo
./check_mongo: line 30: import: command not found
./check_mongo: line 31: import: command not found
./check_mongo: line 32: import: command not found
./check_mongo: line 34: try:: command not found
./check_mongo: line 35: from: command not found
./check_mongo: line 36: except: command not found
./check_mongo: line 37: from: command not found
./check_mongo: line 42: syntax error near unexpected token `('
./check_mongo: line 42: `def main(argv):'

Any other thoughts or ideas to get these MongoDB monitored with Nagios XI? Doesn't appear to be much out there for Nagios XI but did look over the XI guide on how to monitor and it is using the same plugin that I am having an issue with.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: MongoDB Database Monitoring

Post by npolovenko »

@jkinning, Would you consider downgrading the MongoDB version? You could possibly open a support ticket to get assistance with that.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked