How to configure AlertManager? Improve observability of your system easily – Beginners guide

In this article, we will learn about configure AlertManager configuration in simple and easy step by step guide.

A Quick question which comes to mind when talked about monitoring and alerting is 👇

Have you ever considered the effects that go on customers when major corporations like Meta, Google, Netflix, Visa, etc. experience service outages and slow response times?

The second thought that crosses our mind is how these scenarios may be prevented, how can these businesses handle increased uptimes, and what are the solutions to avoid such problems.

Since, there are multiple tools and technologies we can use here, Let’s talk more about AlertManager in this blog.

How to configure AlertManager? Improve observability of your system easily - Beginners guide

How to Configure and setup AlertManager ?

First, we need to download the latest binary of AlertManager from here.

cd /opt/
mkdir alertmanager
wget https://github.com/prometheus/alertmanager/releases/download/v0.25.0/alertmanager-0.11.0.linux-amd64.tar.gz
tar -xvzf alertmanager-0.25.0.linux-amd64.tar.gz
mv -r alertmanager-0.25.0.linux-amd64/ /opt/alertmanager

The AlertManger uses a configuration file named as alertmanager.yml

In this file, the configuration can be setup using its official documentation by configuring the receiver settings accordingly.

Setup Notifications for AlertManager Service

In the route section, it should not have any matchers as it is the entry point for all the alerts which are coming to our AlertManager.

The routes has different receivers based on the condition we want to specify.

For example, as discussed in the previous blog, if there is some CRITICAL issue with the system, we want to send out the PagerDuty alert while for the WARNING alerts, it should only be received at Slack channel only.

In the Receivers section, specify the configuration settings for the receiver.

How to configure AlertManager? Improve observability of your system easily - Beginners guide

Once the configuration is setup, we can create its service file and start the alertmanager service.

create its service file and start the alertmanager service

vi /lib/systemd/system/alertmanager.service
[Unit]
Description=AlertManager Service
Wants=network-online.target
After=network-online.target

[Service]
User=root
Group=root
Type=simple
ExecStart=/opt/alertmanager/alertmanager --config.file /opt/alertmanager/alertmanager.yml -web.external-url=http://x.x.x.x:9093

[Install]
WantedBy=multi-user.target

By Default, the AlertManager service runs on port 9093.

To check the conifguration of AlertManager, there is a tool called as “amtool”. It comes bundled with the AlertManager configuration.
We can use this command to check the AlertManager configuration file before applying it.

It can help in finding out the errors if there are any in the configuration file.

amtool check-config alertmanager.yml

Then reload the system daemon and start the alertmanager service :

systemctl daemon-reload
systemctl start alertmanager
systemctl enable alertmanager
systemctl status alertmanager

To check whether the AlertManager service is running fine without any errors and interruptions, we can run the above status command to see any errors coming up.

Access and use AlertManager Dashboard for ease

Now, you can visit the dashboard for AlertManager on the x.x.x.x:9093

How to configure AlertManager? Improve observability of your system easily - Beginners guide

Wohoo 🥳🥳🥳, We just finished configuring the AlertManager.

This was my little attempt to share the process of configuring the AlertManager with you all.

 If you found it useful, please like this article.

And if you feel there can be some improvement, feel free to share it with me.

🤞 Stay tuned for future posts.

Feel free to contact us and share your feedback in the comment section, for any more conversations regarding Cloud Computing, DevOps, etc.

You can also Read Our Recent Posts

Share

Leave a Comment