Introduction
Lenses 3.1 is finally here with lots of improvements including a better and faster way to send alerts to alert management solutions through different Channels. In this blog post you are going to see how to setup Lenses 3.1 to send alerts to Prometheus Alertmanager.
Pre-requisites
In order to be able to follow the steps of this blog, you will need the following:
Lenses 3.1 (or a newer version when available) up and running. You can use our free Box instance if necessary.
Prometheus Alertmanager up and running
A working network connection between these two machines
The Implementation
The process requires performing the following three steps:
Creating a Connection
Creating a Channel
Associating that channel to one or more existing alerts
Creating a Connection
This step is about pointing Lenses to the desired Alertmanager instance using a connection template. First, you should go to the panel and select ADMIN
. Then, you should click on the Connections
button that will get you to the screen that allows you to select the service that you are going to use, which in this case is Prometheus Alertmanager.New Connection
The next screenshot shows the available templates at the time of writing this.

Click on box in order to give the details of the connection. This is illustrated in the next screenshot.PrometheusAlertmanager

Note that in this case the hostname of the machine that runs Alertmanager is . You should change that to match your configuration.alertmanager
Now that you have given the required information, press on the button to create the connection and you are done. Your connection will be now listed on the Save Connection
tab of the Connections
panel.ADMIN
Creating a Channel
You should now go to the panel and select the ADMIN
tab. Then, you should click on the Channels
button in order to create your channel. First, you will need to select the Channel Type from a list that looks as follows:New Alert Channel

Click on the button for Prometheus Alertmanager. After that, you will be asked to fill in some information.

You can put any name you want on the text box. However, on the Channel
box you should select the appropriate connection from the presented list, which is this case will be Select connection
. The AlertManagerConnection
box should have a descriptive name for your channel and the Source
box should have the URL of your Lenses server.Generator URL
Click on the button and you are done. The only thing left is associating your new channel with one or more alerts.Create Alert Channel
Associating a channel with an existing alert
The last step requires that you associate a channel with one or more existing alerts. Go to the panel and select ADMIN
from Rules
. Press the ALERTS
icon on the right of the Edit
rules that you want to associate with one or more Channels.Infrastructure

Note that you should click on the empty box on the left of a channel name in order to associate that channel with a rule.
The configuration used in this blog post is presented in the next screenshot.

You should now wait for an event to happen in order for Lenses to send an alert to Alertmanager.
Visiting the Alertmanager UI
Prometheus Alertmanager usually uses port number , which means that we should visit the 9093
URL to see its UI, which will look similar to the following:http://alertmanager:9093

If a Kafka broker becomes unavailable or if the Zookeeper server is down, you will get the following kind of output on Alertmanager.

The previous output verifies that Lenses 3.1 can successfully communication with the Prometheus Alertmanager server. Additionally, it shows that there exist two alerts. The first alert is for Zookeeper whereas the second alert is for a Kafka broker.
CRITICAL
Next Steps
Now that you know how easy it is to set up alerts with Lenses 3.1, you should start using that handy feature as soon as possible.







