nagios-plugin-mongodb
nagios-plugin-mongodb copied to clipboard
General MongoDB Error: name must be an instance of basestring
Running the following command:
/usr/lib64/nagios/plugins/check_mongodb.py -H mongo-2 -P 10000 -D -A replication_lag_percent -u *** -p *** -W 50 -C 75
Returns: CRITICAL - General MongoDB Error: name must be an instance of basestring
This doesn't happen when run against a primary, which returns: "OK - This is the primary.", but only against a secondary node.
Confirming this one The problem happens in here:
if percent:
err, con = mongo_connect(primary_node['name'].split(':')[0], int(primary_node['name'].split(':')[1]), False, user, passwd)
Hi,
I have the same issue but as i'm running mongodb 3.0, the problem happens here :
if percent: err, con = mongo_connect(primary_node['name'].split(':')[0], int(primary_node['name'].split(':')[1]), ssl, user, passwd, None, None, insecure, ssl_ca_cert_file, cert_file)
None, None means replicaset=None, authdb=None. This is not valid as you must supply a valid database name to authenticate.
A correct call is :
if percent: err, con = mongo_connect(primary_node['name'].split(':')[0], int(primary_node['name'].split(':')[1]), ssl, user, passwd, replica, authdb, insecure, ssl_ca_cert_file, cert_file)
but you have to change the prototype of function check_rep_lag
def check_rep_lag(con, host, port, warning, critical, percent, perf_data, max_lag, user, passwd, ssl=None, insecure=None, ssl_ca_cert_file=None, cert_file=None)
with
def check_rep_lag(con, host, port, warning, critical, percent, perf_data, max_lag, user, passwd, replica=None, authdb="admin", ssl=None, insecure=None, ssl_ca_cert_file=None, cert_file=None)
Hope this help
Same issue. this is really a great script, but it looks like there is no further development here?
I've created a pull request which solves this issue. See https://github.com/mzupan/nagios-plugin-mongodb/pull/245
I have the same. Realy need this small fix!