Prometheus: Configuring Alert Manager

This documentation is part of the Alerts guide. You can view the complete guide here: How Prometheus alerts work and how to configure them.

👋 Welcome to the Stackhero documentation!

Stackhero offers a ready-to-use Prometheus cloud solution that provides a host of benefits, including:

  • Alert Manager included to send alerts to Slack, Mattermost, PagerDuty, etc.
  • Dedicated email server to send unlimited email alerts.
  • Blackbox to probe HTTP, ICMP, TCP, and more.
  • Easy configuration with online configuration file editor.
  • Effortless updates with just a click.
  • Optimal performance and robust security powered by a private and dedicated VM.

Save time and simplify your life: it only takes 5 minutes to try Stackhero's Prometheus cloud hosting solution!

To configure Alert Manager, edit the alert-manager.yml file. In your Stackhero dashboard, select your Prometheus service, then click on "Alert Manager configuration".

Below, we present the basics. For further details, please refer to the official documentation.

The first step is to configure the receivers. Each receiver is a set of notification integrations (such as email, Slack, etc.) identified by a unique name.

For example, you might create a receiver named "critical_alert" for notifications triggered by alerts with a critical severity. Alternatively, you could create a receiver like "devops_team" to direct alerts to your DevOps team.

Setting a receiver name to "critical_alert" alone will not send alerts. The association between alerts and the receiver is made in the routes configuration described below.

Once a receiver is defined, you will need to set up the corresponding notification integrations. These could include emails, Slack/Mattermost notifications, PagerDuty, Opsgenie, Webhook, and more.

Below is an example of a receiver named "critical_alert" that sends an email to two users and a Slack message to the #alerts channel:

receivers:
- name: "critical_alert"

  # Send critical alerts via email
  email_configs:
    - send_resolved: true
      to: "[email protected]"

  # Send critical alerts to Slack or Mattermost
  slack_configs:
    - send_resolved: true
      api_url: "<your Slack or Mattermost API URL>"
      channel: "#alerts"
      title: "{{ range .Alerts }}{{ .Annotations.summary }}\n{{ end }}"
      text: "{{ range .Alerts }}{{ .Annotations.description }}\n{{ end }}"

You can define multiple receivers to handle different types of alerts. For instance, you might have one for critical alerts, another for error alerts, and another for other alert types.

Instances of Stackhero for Prometheus include a dedicated and private email server that allows you to send an unlimited number of email alerts at no additional cost.

After configuring your receivers, you need to set up the routes. The routes tell Alert Manager how to handle incoming alerts from Prometheus and where to send them (typically to one of your pre-configured receivers).

Below is a basic example that directs alerts with a severity of "critical" to the receiver named "critical_alert":

route:
  routes:
    - match:
        severity: "critical"
      receiver: "critical_alert"

We have pre-configured some routes in the alert-manager.yml file provided with your Stackhero for Prometheus instance. To start receiving alerts, simply update the email_configs and/or slack_configs sections with your notification details.