MongoDB 5.x monitoring SASL failure

I just started a New Relic trial and was attempting a MongoDB monitoring using

https://docs.newrelic.com/docs/infrastructure/host-integrations/host-integrations-list/mongodb-monitoring-integration/

As reporting 2 months ago in

https://githubmemory.com/repo/newrelic/nri-mongodb/issues/76

I get

component=integrations.runner.Runner error=“exit status 1” integration_name=nri-mongodb stderr="[ERR] Failed to create session: server returned error on SASL authentication step: BSON field ‘saslContinue.mechanism’ is an unknown field."

Any suggestions?

@apex

Thank you for reaching out to us. Can you please confirm that you can do the below:

  1. Connecting to MongoDB instance using the steps outlined in the linked doc (please provide the output of the command):

MongoDB Instance with Authentication

If you are able to connect via the mongo client, then further troubleshooting steps need to be taken. If you are not able to connect via the mongo client then more likely the issue is with the username/password being used.

  1. Please try editing mongodb-config.yml FILTERS variable to null:
      # collects all collections for the database.
      filters: '{"db1":null,"db2":["collection1","collection2"],"db3":[]}'

Please let me know the results of these 2 troubleshooting steps. I need the output because if it is still not working then I would recommend Generate logs for troubleshooting.

Please do not hesitate to contact me in case of any additional queries or issues. I will be happy to help you.

Kind regards,

My host is using AWS Linux 2.

My MongoDB server is not set to use TLS.

version();
5.0.6

The New Relic mongodb-config.yml file includes

integrations:

  • name: nri-mongodb
    env:
    MONGODB_CLUSTER_NAME: MyDB,
    HOST: 127.0.0.1
    PORT: 37000
    USERNAME: q_newrelic
    PASSWORD: ****
    AUTH_SOURCE: admin
    SSL: false
    SSL_INSECURE_SKIP_VERIFY: true
    interval: 60s
    labels:

I am able to sign on to MongoDB via mongo --port 37000

The MongoDB log shows this interaction,

{“t”:{"$date":“2022-02-28T17:07:29.356+00:00”},“s”:“I”, “c”:“ACCESS”, “id”:20250, “ctx”:“conn5”,“msg”:“Authentication succeeded”,“attr”:{“mechanism”:“SCRAM-SHA-256”,“speculative”:false,“principalName”:“q_newrelic”,“authenticationDatabase”:“admin”,“remote”:“127.0.0.1:38448”,“extraInfo”:{}}}

The newrelic-infra.yml file now includes
verbose:1
log_file:/var/log/newrelic-infra/stuff.log

I restart the agent using
sudo systemctl restart newrelic-infra

I do a few things with the mongo shell.

The /var/log/newrelic-infra folder has no files though.
FWIW, that folder’s permissions are root:root.

In the NR1 console, Dashboards/MongoDB has no data.

The online doc states,
When verbose is set to 0, verbose logging is off, but the agent still creates logs.

Where are these located?
Thank you.

@apex

The logs should be on the location you choose on the log_file:/var/log/newrelic-infra/stuff.log newrelic-infra.yml, make sure a restart is done once changed the value of verbose = 0 to stop creating logs. Once the logs are generated and you can find them, please review them to make sure if the logs have any message that can help with the troubleshooting. For more details about the verbose logs please see the following for generate detailed logs.

At first I was not seeing any /var/log/newrelic-infra/stuff.log content. I looked at /var/log/messages and determined /etc/newrelic-infra.yml was missing a space after the colon for the verbose and log_file entries. It is now

enable_process_metrics: true
status_server_enabled: true
status_server_port: 18003
license_key: *****
verbose: 0
log_file: /var/log/newrelic-infra/stuff.log

I was able to generate the verbose log records. My /etc/newrelic-infra/integrations.d/ mongodb-config.yml is shown below.

integrations:
- name: nri-mongodb
  env:
    MONGODB_CLUSTER_NAME: MyDB
    HOST: 127.0.0.1
    PORT: 37000
    USERNAME: q_newrelic
    PASSWORD: ****
    AUTH_SOURCE: admin
    SSL: false
  interval: 60s
  labels:

The /etc/mongod.conf file includes

security:
  authorization: enabled

I restart the agent briefly and then stop it.
Running grep on the stuff.log for “mongo” results in the following entry

time="2022-03-03T04:32:51Z" level=debug msg="Integration stderr (not parsed)." component=integrations.runner.Runner integration_name=nri-mongodb line="[ERR] Failed to create session: server returned error on SASL authentication step: BSON field 'saslContinue.mechanism' is an unknown field."

Here are all of the grep’ed entries:

time="2022-03-03T04:31:51Z" level=debug msg="Loading config." component=integrations.Manager file=mongodb-config.yml folder=/etc/newrelic-infra/integrations.d
time="2022-03-03T04:31:51Z" level=debug msg="watching :/etc/newrelic-infra/integrations.d/mongodb-config.yml" component=integrations.Manager folder=/etc/newrelic-infra/integrations.d
time="2022-03-03T04:31:51Z" level=debug msg="Loading integrations from folder." component=integrations.Manager folder=/etc/newrelic-infra/integrations.d found="docker-config.yml, mongodb-config.yml, apache-config.yml"
time="2022-03-03T04:31:51Z" level=debug msg="Integration name not found. Trying another folder, if any." component=integrations.Executables folder=/var/db/newrelic-infra/custom-integrations forName=nri-mongodb
time="2022-03-03T04:31:51Z" level=debug msg="Error looking for integration executables in folder. Trying another folder, if any." component=integrations.Executables error="open /var/db/newrelic-infra/custom-integrations/bin: no such file or directory" folder=/var/db/newrelic-infra/custom-integrations/bin forName=nri-mongodb
time="2022-03-03T04:31:51Z" level=debug msg="Integration name not found. Trying another folder, if any." component=integrations.Executables folder=/var/db/newrelic-infra/newrelic-integrations forName=nri-mongodb
time="2022-03-03T04:31:51Z" level=debug msg="Updated runner." cfgPath=/etc/newrelic-infra/integrations.d/mongodb-config.yml component=integrations.runner.Runner
time="2022-03-03T04:31:51Z" level=debug msg="Found integration definition file." component=PluginRegistry definitionFile=/var/db/newrelic-infra/newrelic-integrations/mongodb-definition.yml
time="2022-03-03T04:31:51Z" level=info msg="loading configuration from /var/db/newrelic-infra/newrelic-integrations/mongodb-definition.yml to hydrate *legacy.Plugin" component="Configuration loader"
time="2022-03-03T04:31:51Z" level=debug msg="Integration prefix not specified in definition, using default." command="[./bin/nri-mongodb --metrics]" component=PluginRegistry integration=com.newrelic.mongodb prefix=integration/com.newrelic.mongodb
time="2022-03-03T04:31:51Z" level=debug msg="Integration definition loaded." component=PluginRegistry integration=com.newrelic.mongodb
time="2022-03-03T04:31:51Z" level=debug msg="Found integration config file." component=PluginRegistry configFile=/etc/newrelic-infra/integrations.d/mongodb-config.yml
time="2022-03-03T04:31:51Z" level=info msg="loading configuration from /etc/newrelic-infra/integrations.d/mongodb-config.yml to hydrate *legacy.PluginInstanceWrapper" component="Configuration loader"
time="2022-03-03T04:31:51Z" level=info msg="loading configuration from /etc/newrelic-infra/integrations.d/mongodb-config.yml to hydrate *databind.YAMLConfig" component="Configuration loader"
time="2022-03-03T04:31:51Z" level=debug msg="Ignoring v4 integration. To be loaded later." component=PluginRegistry configFile=/etc/newrelic-infra/integrations.d/mongodb-config.yml integration=
time="2022-03-03T04:31:51Z" level=debug msg="Ignoring directory or non yaml integration config file." component=PluginRegistry configFile=/etc/newrelic-infra/integrations.d/mongodb-config.yml.sample
time="2022-03-03T04:31:51Z" level=debug msg="Ignoring directory or non yaml integration config file." component=PluginRegistry configFile=/etc/newrelic-infra/integrations.d/mongodb-config.yml.tbd
time="2022-03-03T04:31:51Z" level=debug msg="Starting integrations group." component=integrations.Manager file=/etc/newrelic-infra/integrations.d/mongodb-config.yml
time="2022-03-03T04:31:51Z" level=debug msg="Running task." component=integrations.Definition integration_name=nri-mongodb
time="2022-03-03T04:31:51Z" level=debug msg="Running through all discovery matches." component=integrations.Definition integration_name=nri-mongodb
time="2022-03-03T04:31:51Z" level=debug msg="Found a nil ConfigTemplate." component=integrations.Definition integration_name=nri-mongodb
time="2022-03-03T04:31:51Z" level=debug msg="Executing task." component=integrations.Definition integration_name=nri-mongodb
time="2022-03-03T04:31:51Z" level=debug msg="Waiting while the integration instances run." component=integrations.runner.Runner integration_name=nri-mongodb
time="2022-03-03T04:31:51Z" level=debug msg="Running command." command=/var/db/newrelic-infra/newrelic-integrations/bin/nri-mongodb component=integrations.Executor env="[USERNAME=q_newrelic AUTH_SOURCE=<HIDDEN> SSL=false NRI_CONFIG_INTERVAL=1m0s PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin PORT=37000 PASSWORD=<HIDDEN> MONGODB_CLUSTER_NAME=QarbineDB HOST=127.0.0.1 VERBOSE=1]" path=/var/db/newrelic-infra/newrelic-integrations/bin/nri-mongodb
time="2022-03-03T04:31:51Z" level=debug msg="Integration stderr (not parsed)." component=integrations.runner.Runner integration_name=nri-mongodb line="[ERR] Failed to create session: server returned error on SASL authentication step: BSON field 'saslContinue.mechanism' is an unknown field."
time="2022-03-03T04:31:51Z" level=warning msg="integration exited with error state" component=integrations.runner.Runner error="exit status 1" integration_name=nri-mongodb stderr="[ERR] Failed to create session: server returned error on SASL authentication step: BSON field 'saslContinue.mechanism' is an unknown field."
time="2022-03-03T04:31:51Z" level=debug msg="Integration instances finished their execution. Waiting until next interval." component=integrations.runner.Runner integration_name=nri-mongodb
time="2022-03-03T04:32:11Z" level=debug msg="Using service name as display name." ProcessID=3134 component="Metrics Process" displayName=mongod serviceName=mongod
time="2022-03-03T04:32:31Z" level=debug msg="Using service name as display name." ProcessID=3134 component="Metrics Process" displayName=mongod serviceName=mongod
time="2022-03-03T04:32:51Z" level=debug msg="Running task." component=integrations.Definition integration_name=nri-mongodb
time="2022-03-03T04:32:51Z" level=debug msg="Running through all discovery matches." component=integrations.Definition integration_name=nri-mongodb
time="2022-03-03T04:32:51Z" level=debug msg="Found a nil ConfigTemplate." component=integrations.Definition integration_name=nri-mongodb
time="2022-03-03T04:32:51Z" level=debug msg="Executing task." component=integrations.Definition integration_name=nri-mongodb
time="2022-03-03T04:32:51Z" level=debug msg="Waiting while the integration instances run." component=integrations.runner.Runner integration_name=nri-mongodb
time="2022-03-03T04:32:51Z" level=debug msg="Running command." command=/var/db/newrelic-infra/newrelic-integrations/bin/nri-mongodb component=integrations.Executor env="[USERNAME=q_newrelic PASSWORD=<HIDDEN> PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin PORT=37000 MONGODB_CLUSTER_NAME=QarbineDB HOST=127.0.0.1 AUTH_SOURCE=<HIDDEN> SSL=false NRI_CONFIG_INTERVAL=1m0s VERBOSE=1]" path=/var/db/newrelic-infra/newrelic-integrations/bin/nri-mongodb
time="2022-03-03T04:32:51Z" level=debug msg="Integration stderr (not parsed)." component=integrations.runner.Runner integration_name=nri-mongodb line="[ERR] Failed to create session: server returned error on SASL authentication step: BSON field 'saslContinue.mechanism' is an unknown field."
time="2022-03-03T04:32:51Z" level=warning msg="integration exited with error state" component=integrations.runner.Runner error="exit status 1" integration_name=nri-mongodb stderr="[ERR] Failed to create session: server returned error on SASL authentication step: BSON field 'saslContinue.mechanism' is an unknown field."
time="2022-03-03T04:32:51Z" level=debug msg="Integration instances finished their execution. Waiting until next interval." component=integrations.runner.Runner integration_name=nri-mongodb
time="2022-03-03T04:32:51Z" level=debug msg="Using service name as display name." ProcessID=3134 component="Metrics Process" displayName=mongod serviceName=mongod
time="2022-03-03T04:33:11Z" level=debug msg="Integration has been interrupted" component=integrations.runner.Runner integration_name=nri-mongodb
1 Like

The above is similar to that reported here

which was part of the link first noted

Can’t connect to Mongodb 5.x - githubmemory

hi @apex :wave:

hope you are doing well!

Can you try running the mongo dB integration manually and see if it works?

/var/db/newrelic-infra/newrelic-integrations/bin/nri-mongodb -username [ ] -password [ ] -cluster_name [ ] -host [ ]

can you show us the output of this command?

Best Regards,
Jay vadera

1 Like

Running the command manually as suggested returns the same error:

[ERR] Failed to create session: server returned error on SASL authentication step: BSON field ‘saslContinue.mechanism’ is an unknown field.

This error already has enough documentation on the internet to be a problem with obsolete mongodb-driver. So much so that nri-mongo’s Github has an open issue about it since December, but nothing has been done so far.

Could you help us with the release of a new version of nri-mongodb with support for MongoDB v5.x?

Hey there @thiago.alencar

I hope you are well.

While I am not positive as to when we may have support for MongoDB v5.x I am looping in our experts to give some insight into that and see if there is more troubleshooting we can do for you. We appreciate your patience as we work through this.

Please reach out if you have any other questions and we will be more than happy to assist. I hope you have a good weekend!

Hey @thiago.alencar ! Currently, there is no ETA for the release for the updated MongoDB integration. Our engineers are working on moving to the official MongoDB driver and library, replacing the old 3rd party library and database driver. This will fix multiple issues including the SASL and SCRAM authentication methods. As soon as they have released the latest version with these fixes in place, I will provide an update to this post for you.

Thank you for the update on MongoDB 5.x. Be aware that MongoDB 6.0 will likey be announced June 7th, 2022 per their new delivery schedule.

Hello @apex

Thank you very much for the update. We appreciate your interaction with the community.