Bobcares

AWS Alertmanager: Explained.

by | Aug 20, 2022

Let us take a cloder look in to the AWS and Alertmanager indetail. At Bobacres our sever AWS support services can give you a detailed note on AWS and Alertmanager.

AWS and Alertmanager

aws alertmanager

When the alerting rules that Amazon Managed Service for Prometheus runs fire, the alerts that are delivered are handled by the alertmanager. It separates, groups, and sends warnings to downstream recipients. The Amazon Managed services Only support Amazon Simple Notification Services a receiver for Prometheus. The messages are sent to Amazon SNS subjects in the same account. The AWS Alertmanager can disable and quiet notifications.

The Alertmanager in AWS functions similarly to the Prometheus Alertmanager. The Alertmanagers configuration file is useful for the following operations:

  1. Grouping – Grouping alerts together into a single notification. This is especially beneficial during major outages when numerous systems fail at the same time and hundreds of alarms may fire at the same time. Assume that a network failure causes a large number of nodes to fail at the same time. The alertmanager provides a single notice if similar alerts bundle up. A routing tree in the alertmanager configuration file controls alert grouping and the timing of grouped messages.
  2. Inhibition – If specific other warnings are already firing, inhibition lowers notifications for those alerts. For example, if an alert about an unreachable cluster fire, configure the alert management to muffle any further warnings regarding this cluster. This avoids notifications for hundreds or thousands of firing alarms that have nothing to do with the main problem.
  3. Silences – The AWS, alertmanager Silences or mutes warnings for a set period of time, such as during a maintenance period. Incoming alerts are checked to see if they match all of an active silence’s equality or regular expression matchers. If they do, then the alerts for that alert won’t deliver.

Creating an Alertmanager configuration file

Create an alertmanager configuration YAML file through AWS to use alertmanager and templating in Amazon Managed Service for Prometheus. There are two major sections in an Amazon Managed Service for Prometheus alert management file:

  1. template_files: This file contains the templates.
  2. alertmanager_config: includes the configuration for the alertmanager In standalone Prometheus, this has the same format as an alert management config file.

    The AWS and alertmanager configuration file in Amazon Managed Service for Prometheus must contain all of the alertmanager configuration material inside of an alertmanager config key at the base of the YAML file.

    A basic sample alert management configuration file is provided below :

    alertmanager_config: |
    route:
    receiver: 'default'
    receivers:
    - name: 'default'
    sns_configs:
    - topic_arn: arn:aws:sns:us-east-2:123456789012:My-Topic sigv4:
    region: us-east-2
    attributes:
    key: key1
    value: value1

    Presently it only supports the Amazon Simple Notification Service receiver (Amazon SNS). It will refuse if additional types of receivers are present in the configuration. Here’s another AWS and alertmanager configuration file that makes use of both the template files and alertmanager config blocks.

    template_files:
    default_template: |
    {{ define "sns.default.subject" }}[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}]{{ end }}
    {{ define "__alertmanager" }}AlertManager{{ end }}
    {{ define "__alertmanagerURL" }}{{ .ExternalURL }}/#/alerts?receiver={{ .Receiver | urlquery }}{{ end }} alertmanager_config: |
    global:
    templates:
    - 'default_template'
    route:
    receiver: default
    receivers:
    - name: 'default'
    sns_configs:
    - topic_arn: arn:aws:sns:us-east-2:accountid:My-Topic
    sigv4:
    region: us-east-2
    attributes:
    key: severity
    value: SEV2

    Default Amazon SNS template block

    Unless expressly overridden, the default Amazon SNS setup utilizes the following template.

    {{ define "sns.default.message" }}{{ .CommonAnnotations.SortedPairs.Values | join " " }}
    {{ if gt (len .Alerts.Firing) 0 -}}
    Alerts Firing:
    {{ template "__text_alert_list" .Alerts.Firing }}
    {{- end }}
    {{ if gt (len .Alerts.Resolved) 0 -}}
    Alerts Resolved:
    {{ template "__text_alert_list" .Alerts.Resolved }}
    {{- end }}
    {{- end }}
    This is the final step in configuring and managing alertmanager AWS.

    [Need assistance with similar queries? We are here to help]

    Conclusion

    To conclude, the AWS alertmanager forwards the alerts to SNS, which forwards them to downstream sites. And, Alerting rules configured will send alerts to the AlertManager, which will deduplicate, group, and route notifications to Amazon SNS through the SNS receiver.

    PREVENT YOUR SERVER FROM CRASHING!

    Never again lose customers to poor server speed! Let us help you.

    Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

    GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.