MongoDB monitoring errors

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
stecino
Posts: 248
Joined: Thu Mar 14, 2013 4:42 pm

MongoDB monitoring errors

Post by stecino »

Hi all, I am running into issues on some of my MongoDB monitors. (stageutil01 is my Nagios server)

Here is what I have:

define command {
command_name check_mongodb
command_line $USER1$/check_mongodb.py -H $HOSTADDRESS$ -A $ARG1$ -P $ARG2$ -W $ARG3$ -C $ARG4$
}

These services don't work'

define service {
use generic-service
hostgroup_name stage_mongo,prod_mongo_8083
service_description Mongo_Free_Connections_8083
check_command check_mongodb!connections!8083!70!80
}


define service {
use generic-service
hostgroup_name stage_mongo,prod_mongo_8083
service_description Mongo_Memory_Usage_8083
check_command check_mongodb!memory!8083!cds!mongo2013p!20!28
}

[root@stageutil01 libexec]# ./check_mongodb.py -H stagedb03 -A memory -P 8083 -u cds -p mongo2013p
CRITICAL - General MongoDB Error: command SON([('authenticate', 1), ('user', u'cds'), ('nonce', u'd9ff7ee0be88d9d8'), ('key', u'd74ef08e18a6d533335be236456035aa')]) failed: auth fails

[root@stageutil01 libexec]# ./check_mongodb.py -H stagedb03 -A connections -P 8083 -u cds -p mongo2013p
CRITICAL - General MongoDB Error: command SON([('authenticate', 1), ('user', u'cds'), ('nonce', u'f24ca43bec7e05dd'), ('key', u'f72e9a2bccf05ee7ed113bade42f762b')]) failed: auth fails

These services work

# Check Replication Lag
define service {
use generic-service
hostgroup_name stage_mongo,prod_mongo_8083
service_description Mongo_Replication_Lag_8083
check_command check_mongodb!replication_lag!8083!15!30
}

# Check Replication Lag
define service {
use generic-service
hostgroup_name stage_mongo,prod_mongo_8083
service_description Mongo_Replication_Lag_Percentage_8083
check_command check_mongodb!replication_lag_percent!8083!50!75
}

[root@stageutil01 libexec]# ./check_mongodb.py -H stagedb03 -A replication_lag_percent -P 8083 -W 50
OK - Not running with replSet
[root@stageutil01 libexec]# ./check_mongodb.py -H stagedb03 -A connect -P 8083 -W 50
OK - Connection took 0 seconds


===========

For those services that fail, I'm assuming that I use DB user name/pwd and not server user/pwd combination.
I also tried to update my command definition to explicitly include user and password as arguments. But still didn't help

Thanks in advance
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: MongoDB monitoring errors

Post by slansing »

Have you given the plugin's documentation a read-through? I believe it shows exactly how you need to configure both ends:

https://github.com/mzupan/nagios-plugin-mongodb
stecino
Posts: 248
Joined: Thu Mar 14, 2013 4:42 pm

Re: MongoDB monitoring errors

Post by stecino »

THat's exactly what I used to setup my monitoring. Hence my question, why is it failing authentication for a few monitors, when none of them have user/password parameters specified in the command
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: MongoDB monitoring errors

Post by abrist »

Do you have any logs for the mongodb that you can check? Maybe auth is actually failing on the mongo server?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
stecino
Posts: 248
Joined: Thu Mar 14, 2013 4:42 pm

Re: MongoDB monitoring errors

Post by stecino »

Looks like it can't find the cds user in the admin.system.users table

Thu Mar 28 14:57:47 [initandlisten] connection accepted from 10.198.4.29:33979 #139665 (118 connections now open)
Thu Mar 28 14:57:47 [conn139665] authenticate db: admin { authenticate: 1, user: "cds", nonce: "7ad14cc52f1255", key: "ae9d476cef5414cea8b0671986ae2bd5" }
Thu Mar 28 14:57:47 [conn139665] auth: couldn't find user cds, admin.system.users
Thu Mar 28 14:57:47 [conn139665] end connection 10.198.4.29:33979 (117 connections now open)
stecino
Posts: 248
Joined: Thu Mar 14, 2013 4:42 pm

Re: MongoDB monitoring errors

Post by stecino »

I was able to resolve the issue with superAdmin user credentials.

Plus in addition to that what I ended up doing was to setup check_mongodb_login where I explcitly define user and password

Thanks, everyone for you input
Locked