This article will be helpful if you use the Percona Monitoring and Management (PMM) instance and alert notifications, as it is nice to capture the image of the graph when you receive the alert. We will see how to capture and attach the image of the graph when receiving the alert notification (email, telegram, Slack, etc.) to whatever channel it sends it to.

This demo will be done using Telegram. This article assumes that you already have PMM and alert notifications configured with one of the channels and are already receiving the alert notifications. In this demo, we use Telegram for alert notifications.

Existing setup

I have the below installation for PMM:

Alerts and contact points have been configured, and alerts are notified in Telegram.

Here is an example alert for Telegram:

We see no image in the attachment right now with the notifications.

How do we capture images in the alert notifications?

The Grafana image renderer plugin will help us capture the graph image. We would need to set up the grafana-image-render plugin. With the release of our PMM 2.43.2, secure Grafana image renderer installation is supported.

Since the deployment will be in another container, both the PMM container and the Grafana image renderer container need to communicate with each other. We need to connect it by configuring the same docker network.

Setting up the Grafana image renderer remote plugin container

Since we would need the containers to ping with their hostname, we will need to use non-default bridge network. Let’s create one.

We will use it to set up a Grafana image renderer container with the same network.

So, we will use the below docker command to set up the remote container for the grafana-image-renderer plugin.

If you are not using any certificate with PMM, make sure you use IGNORE_HTTP_ERRORS environmental variable so that the image for the graph can be captured successfully. If you have proper SSL certificates for PMM, you can ignore that.

We are also using the network that we created with docker.

You should see the below output:

Integrating PMM server with grafana-image-renderer container

Stop your PMM container and remove it.

NOTE: Make sure that you have pmm-data volume before removing this container. If you were not using pmm-data volume earlier, this will also remove your data.

Start a new PMM server container with the GF_RENDERING_SERVER_URL and GF_RENDERING_CALLBACK_URL environment variables.

Add the additional parameters in the docker run if you have customized the docker container for the PMM Server.

Now, when the alert triggers, there will be a screenshot attached for the graph:

Summary

You can always go back to the pmm-server to check the graph of the required alerts. The data in PMM is stored by default for 30 days unless you have defined retention. This could be a good feature if you want to review the graphs and the alert notification when the alert is triggered. This can also be helpful to review the graph image if you wish to review the alert before your data retention period to analyze the behavior or for performance comparison. I have also tested this with email, and it works as expected.

Percona Monitoring and Management is a best-of-breed open source database monitoring solution tool for MySQL, PostgreSQL, MongoDB, and the servers on which they run. Monitor, manage, and improve the performance of your databases no matter where they are located or deployed.

 

Try Percona Monitoring and Management

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments