In this post, we’ll walk through the configuration of setting up the integration of sending the alert notification from MongoDB Atlas to a Slack Channel.0

Let’s log into MongoDB Atlas Cloud Console and access to the Project Alert page via the bell icon at top right in the console.

We can click on Add new Alert or edit an existing alert.

Let’s take an example here as Atlas will send an alert when any host is restarted. Then the notification will be sent to all roles via email and add additional notifier of Slack.

Click through the “Add Notifier” dropdown list and select Slack. Then we need to configure the Slack Channel Name and Slack API Token.

Coming back to our Slack side, we’ll create a new channel naming #mongodb-atlas-alert.

To configure the token for the integration between Atlas and Slack, we go to https://api.slack.com/apps and create a new app.

Let’s create a sample app naming “mongodb-atlas-notification” and assign it to our workspace. Within this tutorial, it’s “TestWorkSpace”

We’ll define the features and functionality of this app which is Bots.

In the Scopes, we need to add the scopes of “chat:write” and “chat:write:public” as minimum granted permission for the bot.

After that we need to install the app to our workspace or click on Reinstall to Workspace. Then we copy the token value of “Bot User OAuth Token”.

We configure the Slack Channel naming #mongodb-atlas-alert as created above and paste the Slack API Token. Then click “Post test message to Slack”

Atlas will send an test notification to Slack channel.

We can trigger a restart in Primary to test the resiliency as well as get the relevant notification. This is not recommendation on Production without consideration.

Atlas will trigger a restart on Primary in order to simulate an auto-failover.

The notification is sent to Slack channel as a Primary host is restarted.

Thank you!

Leave a comment

I'm Emily

Welcome to Nook, my cozy corner of the internet dedicated to all things homemade and delightful. Here, I invite you to join me on a journey of creativity, craftsmanship, and all things handmade with a touch of love. Let's get crafty!

Let's connect