Trying to installing Newrelic for mongodb monitoring

Hello Team, I have installed mongodb(version 4.4 and 5) in ubuntu (version 20). I want to monitor mongodb using newrelic. so i followed the instruction to install newrelic for mongodb. but it is getting failed and showing unsupported error. For more info i am attaching the command which I am using to install newrelic and image of errror. Please help me find the solution for this issue.

Newrelic Command= curl -Ls https://download.newrelic.com/install/newrelic-cli/scripts/install.sh | bash && sudo NEW_RELIC_API_KEY=**** NEW_RELIC_ACCOUNT_ID=******* /usr/local/bin/newrelic install -n mongodb-open-source-integration***

Hello @questt.devops ,

Thank you for posting your query!

Can you please try installing the integration using manual method

First install the agent on your OS then, manually install the integration.

Also, Can you please tell your OS details.

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

Best Regards,
Yashaswi verma

@yverma1 thanks for the reply. I am using ubuntu (version 20). I am also gone through the manual steps. Manual steps are not clear. I am not sure how can i check if manual steps are correct. if you can provide manual steps with explicit steps , i think that will be great for me. thanks

Hello @questt.devops ,

Remember to install the agent through guided install HERE.

  1. Follow the instructions for installing an integration, using the file name nri-mongodb.

  2. Change directory to the integrations folder:

cd /etc/newrelic-infra/integrations.d
  1. Copy of the sample configuration file:
sudo cp mongodb-config.yml.sample mongodb-config.yml
  1. Edit the mongodb-config.yml file as described in the configuration settings.
  2. Restart the infrastructure agent.
  3. To enable automatic MongoDB error log parsing and forwarding, copy (or rename) the mongodb-log.yml.example file to mongodb-log.yml. No need to restart the agent.Example:
sudo cp /etc/newrelic-infra/logging.d/mongodb-log.yml.example /etc/newrelic-infra/logging.d/mongodb-log.yml

Best Regards
Yashaswi verma

Thanks for specifying the steps. I have tried but not working. I am sharing mongo-config.yml file with you. Please let me know what I am missing and for restart I am using sudo systemctl status newrelic-infra and I am not sure how to check if mongodb configuration is working correctly or get more info through logs so that i can debug accordingly.
Thanks

integrations:
  • name: nri-mongodb
    env:

    The mongos to connect to

    HOST: localhost

    The port the mongos is running on

    PORT: “27017”

    The username of the user created to monitor the cluster.

    This user should exist on the cluster as a whole as well

    as on each of the individual mongods.

    USERNAME: abc

    The password for the monitoring user

    PASSWORD: abc

    The database on which the monitoring user is stored

    AUTH_SOURCE: admin

    A user-defined cluster name. Required.

    MONGODB_CLUSTER_NAME: testcluster

    Connect using SSL

    SSL: “false”

    Path to the CA certs file

    SSL_CA_CERTS: /sample/path/to/ca_certs

    Skip verification of the certificate sent by the host.

    This can make the connection susceptible to man-in-the-middle attacks,

    and should only be used for testing

    SSL_INSECURE_SKIP_VERIFY: “false”

    Passphrase to decrypt PEMKeyFile file (optional)

    PASSPHRASE: secret

    Client Certificate to present to the server (optional)

    PEM_KEY_FILE: /sample/file.pem

    The number of entities to collect metrics for concurrently. Tunable to

    limit CPU and memory usage

    CONCURRENT_COLLECTIONS: “50”

    A JSON map of database names to an array of collection names. If empty,

    defaults to all databases and collections. If the list of collections is null,

    collects all collections for the database.

    FILTERS: ‘{“db1”:null,“db2”:[“collection1”,“collection2”],“db3”:[]}’

    interval: 15s
    labels:
    env: production
    label: mongo-cluster-1
    inventory_source: config/mongodb

Hello @questt.devops,

Thank you for your query.

  1. Can you please run this integration manually and see if it works :
    /var/db/newrelic-infra/newrelic-integrations/bin/nri-mongodb -host host -cluster_name my_cluster -port port -username: username -password password -auth_source auth source -ssl true

  2. You can check the verbose logs here to debug the issue : Please see the document HERE.

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

Best Regards,
Yashaswi Verma

Thanks for the reply. I am getting below error and can you please tell me what is -cluster_name here. can we connect over call to resolve this early??

root@questt-staging-mongo:/etc/newrelic-infra/integrations.d# /var/db/newrelic-infra/newrelic-integrations/bin/nri-mongodb -host localhost -cluster_name navigator -port 27017 -username abc -password abc -auth_source admin

[WARN] Using the deprecated config ClusterName instead of MongodbClusterName
[ERR] Failed to create session: server returned error on SASL authentication step: BSON field ‘saslContinue.mechanism’ is an unknown field.

root@questt-staging-mongo:/etc/newrelic-infra/integrations.d# /var/db/newrelic-infra/newrelic-integrations/bin/nri-mongodb -host localhost -cluster_name admin -port 27017 -username abc -password abc

[WARN] Using the deprecated config ClusterName instead of MongodbClusterName
[ERR] Failed to create session: server returned error on SASL authentication step: BSON field ‘saslContinue.mechanism’ is an unknown field.
root@questt-staging-mongo:/etc/newrelic-infra/integrations.d#

Hello @questt.devops ,

Thank you for your patience! Can you create a case in Newrelic support portal .

Aslo , Please try these steps :slight_smile:

As the error represents we are not able to create a connection

  1. Please Check compatibility and requiremt.

2.Create roles and user for newrelic to access the cluster.

3.Try to connect to mongo db instance through that user and password.

  1. Then try to run the command given on previous reply and see if you are able to create a session,

  2. Also I am attaching the sample yaml file , Note : for atlas there is another config.yml .

please follow this !

Best Regards
Yashaswi verma

Hello @yverma1 , I am getting below output. but still newrelic is not sending logs for mongodb.
can you tell me is this output is correct?

Hello @questt.devops ,

Yeah , it seems to be working manually . So it will work via integartion as well .

Can you please update the details in the mongodb-config.yml , as you have mentioned it here in the command. and restart the infra agent .

You can see the data in infrastructure>third party services > Mongo DB.

If it doesn’t work can you please get the verbose logs

Best Regards
Yashaswi verma

Thanks @yverma1 , It is working fine with mongo version 4.4 but giving below error with version 5 and above.

[ERR] Failed to create session: server returned error on SASL authentication step: BSON field ‘saslContinue.mechanism’ is an unknown field.
root@questt-staging-mongo:/etc/newrelic-infra/integrations.d#

can you share how can i connect with version 5?

Hello @questt.devops ,

Glad to hear that it got working after your hardwok!

Currently we do not support v5 which is mentioned here in the DOCS

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

Best Regards
Yashaswi verma