Skip to content

2. Slack Event Configuration

What This Chapter Does

It configures APM events to arrive in a Slack channel. When a failure occurs, the message appears in a channel the team is already watching.

There are two methods. Choose one.

MethodWhat is differentWhen to choose it
WebhookYou obtain an address (URL) that posts to one channel and enter it in APMMost cases -- the setup is simpler
BotYou install an app in the workspace and send with a tokenWhen you want to post to several channels, or change the bot name and icon

What you need -- a Slack workspace and permission to add an app to it. If you have no workspace, you can create one by following the steps below.

Once configured -- every time an event occurs in APM, a message appears in the channel you chose.

Overall Flow

StepWhat you do
1Prepare the Slack workspace and channel (skip if you already have them)
2Obtain a webhook address or a bot token
3Enter that value in the event settings of the APM console
4Confirm it reaches the channel with a test send

Webhook Method

You obtain an address that posts to one channel and enter it in APM. This method is enough for most cases.

1) Create a Slack App

Go to https://api.slack.com/apps, create an app with Create New App, and choose the workspace.

Creating a new app on the Slack API site

2) Turn on Incoming Webhooks and Choose a Channel

In the app settings, go to the Incoming Webhooks menu, turn on Activate Incoming Webhooks, then choose the channel that receives events with Add New Webhook to Workspace.

Turning on Incoming Webhooks

3) Copy the Webhook URL

Once the channel is chosen, a Webhook URL is created. Copy this address and enter it in the Webhook URL field in Configuring Events in APM.

The issued webhook URL
The webhook URL is a secret

Anyone who knows this address can post to that channel. Do not leave it as it is in documents or code repositories.

Bot Method

A webhook is fixed to one channel, but a bot can post to several channels and its name and icon can be changed. It takes a few more steps in return.

1) Add the Bot and Get a Token

Find Bots in the Slack app list, add it to the workspace, decide the bot's user name, then click Add bot integration.

Finding and adding Bots in the Slack app list

The API Token appears on the next screen.

The API Token on the bot settings screen
Copy the API Token

This value is the key to the integration with APM. It is troublesome to find again once you leave the screen, so copy it now and finish by clicking Save integration.

2) Create the Channel That Receives Events

Create a channel with Add channel > Create a new channel and give it a name. Add the people who should see the alerts with Add people.

Creating a new channel

3) Invite the Bot to the Channel

In the channel you created, enter /invite @<bot name> to invite the bot. Without the invitation, no message arrives even when the token is correct.

Configuring Events in APM

In the OPENMARU APM console, go to Settings > Monitoring Settings and select the Event Channels tab to configure the Slack event settings. Every channel setting is gathered on this one screen.

Slack Event Configuration Items

Change the values shown in the Slack section.

ItemDescription
① EnabledWhether to use the Slack integration. Set it to "TRUE" to receive event alerts.
② API TypeSelects how the Slack integration is configured (Webhook or Bot).
③ Webhook URLFor the Webhook method, enter the webhook URL created earlier.
④ Bot API TokenFor the Bot method, enter the bot API token issued earlier.
⑤ ChannelEnter the name of the channel created earlier that receives APM events.
⑥ Message Locale / Message LanguageSetting KR/KO sends Korean messages; setting US/EN sends English messages.

Confirming Events Arrive in the Slack Channel

Restart the APM server, and you can see APM events in the Slack openmaru-apm channel, delivered through the webhook you connected or the @openmaru_apm bot.

Add the users who want to receive events to the openmaru-apm channel.

Slack events can be received through a range of clients -- the iOS and Android apps, a browser, and the Windows application.

Slack is reachable through a browser by default, and also through desktop applications for macOS, Windows, and Linux, or the mobile apps for iOS, Android, and Windows Phone.