Before You Begin
Note: MongoDB Atlas Serverless and shared clusters (M0, M2, M5) are not supported.
Grant Access to Your MongoDB Atlas Cluster
The Atatus Infra Agent requires read-only permissions to collect operational statistics and query metrics from MongoDB Atlas.Step 1: Create a Custom Monitoring Role
- Log in to the MongoDB Atlas UI.
- Navigate to Database Access → Custom Roles.
- Click Add New Custom Role.
-
Enter a role name (example:
atatus-monitor). -
Add the following privileges:
readon theadmindatabasereadon thelocaldatabasereadon theconfigdatabase (for sharded clusters only)clusterMonitoron theadmindatabasereadon specific application databases or usereadAnyDatabaseto monitor all databases
- Save the custom role.
Step 2: Create a Monitoring User
- In the MongoDB Atlas UI, go to Database Access → Database Users.
- Click Add New Database User.
- Choose Password Authentication.
- Enter a username and strong password.
- Under Database User Privileges, assign the custom role created earlier.
- Click Add User.
- Save the username and password. You will use them when configuring the Atatus Agent.
Install and Configure the Atatus Agent
The Atatus Infra Agent must run on a host that can network-connect to your MongoDB Atlas cluster.Resolve Individual MongoDB Host and Port
MongoDB Atlas applications usually connect using an SRV connection string. However, the Atatus Agent must connect directly to individual MongoDB hosts to avoid inaccurate metrics during failover or load balancing. Use DNS tools to resolve the SRV record and extract hostnames.- Replica Set
Resolve Replica Set NodesFor an SRV connection string like Example output:Windows:Example output:Use these resolved values as host and port combinations:Configure the Agent using one of these host and port combinations.
mongodb+srv://cluster.example.mongodb.net/, use the following commands:Linux:The Agent must connect consistently to the same MongoDB host. Avoid connecting through load balancers, proxies, or rotating endpoints.
Create the configuration file
- Replica Set
For a MongoDB replica set, the Atatus Agent must connect to all replica members (primary, secondary, and arbiter if present). Update the configuration file by adding the following configuration to Restart the Atatus Infra Agent to apply the changes:
/etc/atatus-infra-agent/conf.d/mongodb.d/mongodb.yml: