How Does eG Enterprise Monitor MongoDB?

eG Enterprise can monitor MongoDB in an agent-based or an agentless manner. In case of the agentless approach, the remote agent used to monitor the MongoDB server should be deployed on a remote Windows host in the environment.

Regardless of the approach (agent-based or agentless), the eG agent connects to a database on the MongoDB server instance and runs built-in MongoDB API commands to pull the metrics of interest from across databases. To enable this connection, each test that the eG agent runs on the MongoDB server instance should be configured with the name of a MongoDB database.

In highly secure environments, access control may be enabled on the target MongoDB deployments. Such deployments enforces authentication, which requires users to identify themselves while accessing the MongoDB. eG Enterprise can monitor the MongoDB databases that are access control enabled too. For this administrators need to do the following:

  • create a custom role
  • assign a user to that role
  • Finally, enable access control i.e., authenticate the user.

How to monitor access control enabled MongoDB database?

To monitor the access control enabled MongoDB database, it is essential to create a custom role in the admin database of the MongoDB instance and a user.

  • To create a custom role for e.g., egmonrole, issue the following command on the MongoDB instance:

    db.createRole({role: "egmonRole",privileges: [{ resource: { anyResource: true}, actions: [ "serverStatus" ,"dbStats","top", "listDatabases", "getCmdLineOpts", "collStats", "hostInfo", "listCollections", "find", "replSetGetConfig", "replSetGetStatus"] }],roles: [] })

  • Once the role is created, you can create a user for e.g., eguser and assign the newly created role i.e., egmonrole to that user by issuing the following command:

    db.createUser({ user: "eguser", pwd: "egurkha", roles: [ "egmonRole" ]} )

  • Once you have created the user, you need to specify the credentials of the user while configuring the tests for the target MongoDB instance being monitored.