Documentation

MongoDB Checks

About MongoDB Checks

The MongoDB check allows you to monitor MongoDB database services. You can verify that the database server is accepting connections, or optionally to login and run a query, and verify that the query results match or are within user-defined limits.

If you choose to verify query results, the check connects to the MongoDB service and makes a user-defined database query. It then verifies the results of the query with user-defined fields. The results can be either numeric or strings.

For numeric query results, the MongoDB check will verify that the number is within the user-defined minimum and maximum range. If the result is outside that range, the check will fail and notifications will be sent.

For string query results, the MongoDB check will try an exact match against the user-defined 'match' field. The 'match' field also supports regular expressions (regex) matching.

When to use MongoDB Checks

NodePing's MongoDB monitoring can be used to test the availability of a MongoDB database service. It can also be used to verify the results of a query, track the result value and send notifications for values that don't match or are outside of a given range. Examples include graphing visitors on a website, accounts of a particular status, or number of downloads for a particular file.

It is often required to whitelist connections from our probes in the service firewall for the monitoring to function. A list of our probe IPs can be found in the FAQ. The check can also run from an AGENT installed in your secure environment so you don't have to poke holes in your firewalls or port forward to it.

If your MongoDB service requires authentication please remember that by providing a username/password to someone that is not you, you are creating a new risk. This decision should be weighed very carefully. Please keep our Terms of Service in mind when you are configuring your Mongo checks. It is best practice when you are creating a user for MongoDB monitoring that you have a separate user for monitoring that is restricted to read-only as discussed in the MongoDB documentation.

Using MongoDB Checks

To set up a MongoDB check,

  1. Select MongoDB from the Check type drop down.
  2. Give it a friendly label to identify this check in lists and notifications.
  3. Enable Automated Diagnostics if you'd like detailed technical info about the failure that may help you troubleshoot.
  4. Set how often you want the check to run on the Check Frequency field. Sub-minute intervals may have additional costs.
  5. Set the URI of the MongoDB service. username, password, and port must all be set in the URI. For example:
    mongodb://myuser:mypassword@mongohost.example.com:27017/
    The port in the above URI is 27017.
  6. Optionally set the name of the database to use in the 'Database' field. A database is required if you want to send a query and verify query results. If left blank, no query is sent and only the MongoDB connection will be tested.
  7. Optionally set the name of the collection to use in the 'Collection' field. A collection is required if you want to send a query and verify query results. If left blank, no query is sent and only the MongoDB connection will be tested.
  8. Set your optional database query in the 'Query' field. This value must be valid JSON. If left blank, no query is sent and only the MongoDB connection will be tested.
  9. If you've set a query, you can verify the results using the 'Query Results' section. Enter the field name. If the results are expected to be numeric, set the 'Min' and 'Max' fields to your desired range. If the results are expected to be a string, set the 'Match' field to either the exact match expected or a regular expression (regex).
  10. Set a time out. The default 5 seconds works fine for most situations.
  11. Set the Sensitivity. High is usually appropriate.
  12. Set the notifications for this check. More information about notifications.

Common usage:
To monitor availability of MongoDB database services.
To verify a MongoDB query result and track, graph, and notify a numeric or string result.

Other considerations

IPv6 URLs require the bracket formatting such as mongodb://[2606:c700:4020:11::53:4a3b]/

If you have any questions, get in touch at support@nodeping.com, or use our Contact form.