Setting up Percona Monitoring and Management (PMM) alerts for multiple channels can significantly enhance your monitoring strategy. In this blog post, we will talk about the steps to configure alerts for some well-known communication platforms like Telegram, Slack, and WebHook.

Please note that I am not covering the basic alerting and configuration setup. For that, you can refer to the official manual:- https://docs.percona.com/percona-monitoring-and-management/get-started/alerting.html#percona-alerting

Before using these channels, it is essential to first create some alerts for notification purposes.

PMM alerts

https://docs.percona.com/percona-monitoring-and-management/get-started/alerting.html

Setting up PMM alerts for Slack

1) Go to the Slack API website – https://api.slack.com/apps

2) Then, click on “Create New App” and follow the prompts to create a new app for your workspace.

Configuring PMM alerts for Slack

  • Choose the “slack workspace” and define the “app name”.  You can also create/add a new workspace in Slack as required instead of using the existing ones.

  • Then, select the “Bots” section.

  • And, click the “Review Scopes to Addsection.

  • Here, we need to add the different “Scopes” levels or types of access for the Slack app.

  • Then, hit the “Install to Workplace” section.

3) Now, you will see the “OAuth Token,” which we will use later in PMM Slack configurations.

4)  Next, we need to add the app “pmm_alerts” to one or more Slack channels in order to get the notifications.

5) Finally, we can add the details below in the PMM -> Alerting -> Contact Points section.

  • On successful testing we should see some test alerts.

  • The original alert message based on the trigger condition will look like below.

Setting up PMM Alerts for Telegram

For the Telegram app, we also need the “BOT API Token” and “Chat ID” details to set up alert notifications.

1) Create a new bot in Telegram. Select “@BotFather” in the search tab and send the command “/newbot” in the chat section.

Configuring PMM Alerts for Telegram

2) Provide a “name” for your bot and then a “username” for the bot. The username needs to end in “bot”.

Here, we have received the BOT API Token :- 6396505873:AAEQT5DCFAlzpqqdh9p69YwiQermTespfDA

3) Now, we need to change the “group privacy policy” in order to allow the bot to read messages sent to any group it is a member of.

  • In the “@BotFather” section, type “/setprivacy” for user:- “@pmm_test_alerts_bot” and disable “Disable” the group policy as below:

4) After disabling group privacy, create a group “pmm_alerts” and add the new bot: “pmm_test_alerts” to that group.

So here, we have successfully created the group. Now, we need to send at least one message in order to activate the group.

5) Next, we need the second input, “Chat ID,” that PMM requires. This can be done using either curl or directly running the URL on the web browser.

Here, we are using the complete token “6396505873:AAEQT5DCFAlzpqqdh9p69YwiQermTespfDA” we got in step 2. In order to use this with the API, we need the prefix “bot” in the string.

Output:

So finally, we got the CHAT ID “-4013864418″ as well.

6) Now it’s time to use the above details in the PMM -> Alerting -> Contact Points section.

  • On successful testing we should see some test alerts.

  • If we trigger a real alert, it will appear like this.

Setting up PMM Alerts for WebHook

Webhooks are a powerful tool for building integrations between different applications or services, enabling them to work together seamlessly. They are widely used in web development, APIs, and cloud services to create more dynamic and responsive systems.

URL/API:

In simple terms, it’s just an API that can be created in any programming language (PHP, Java, Node Js, etc.) to send and get the response and integrate that with any 3rd party applications. 

Here, we are simply integrating the URL with the PMM in order to get the response. 

Configuring PMM Alerts for WebHook

Response from the URL

The above response can be generated via directly submitting the URL or by using tools like Postman or cURL, which are widely used to interact with the HTTP-based APIs.

There are a few use cases where webhook would be useful:

  • Webhooks allow systems to receive real-time updates when certain events occur. For example, in a messaging application, a webhook can be used to notify a third-party service whenever a new message is received.
  • Webhooks are commonly employed for sending notifications. This could include alerts for system events, status changes, or important updates. For example, a monitoring system can use webhooks to notify administrators when there’s a critical issue.

 

Percona Monitoring and Management is a best-of-breed open source database monitoring solution. It helps you reduce complexity, optimize performance, and improve the security of your business-critical database environments, no matter where they are located or deployed.

 

Download Percona Monitoring and Management Today

Further references:

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments