Navigate to Alertmanager download page and grab the URL. Use this URL to download with wget:
wget https://github.com/prometheus/alertmanager/releases/download/v0.27.0/alertmanager-0.27.0.linux-amd64.tar.gz
Create a user, required directories, and make user as the owner of those directories:
groupadd -f alertmanager
useradd -g alertmanager --no-create-home --shell /bin/false alertmanager
mkdir -p /etc/alertmanager/templates
mkdir /var/lib/alertmanager
chown alertmanager:alertmanager /etc/alertmanager
chown alertmanager:alertmanager /var/lib/alertmanager
Extract the tarball and switch the directory:
tar xvf alertmanager-0.27.0.linux-amd64.tar.gz
cd alertmanager-0.27.0.linux-amd64
Copy alertmanager and amtool binary to /usr/local/bin and change the ownership to added user:
cp alertmanager /usr/local/bin
cp amtool /usr/local/bin
chown alertmanager:alertmanager /usr/local/bin/alertmanager
chown alertmanager:alertmanager /usr/local/bin/amtool
Copy alertmanager.yml to the /etc/alertmanager and change the ownership:
cp alertmanager.yml /etc/alertmanager/
chown alertmanager:alertmanager /etc/alertmanager/alertmanager.yml
Create an alertmanager service file at /etc/systemd/system/alertmanager.service:
[Unit]
Description=AlertManager
Wants=network-online.target
After=network-online.target
[Service]
User=alertmanager
Group=alertmanager
Type=simple
ExecStart=/usr/local/bin/alertmanager \
--config.file /etc/alertmanager/alertmanager.yml \
--storage.path /var/lib/alertmanager/
[Install]
WantedBy=multi-user.target
Reload the systemd, start and enable the service:
systemctl daemon-reload
systemctl start alertmanager
systemctl enable alertmanager
systemctl status alertmanager
Access the AlertManager UI on http://x.x.x.x:9093...
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
- x.x.x.x:9093
...
And restart Prometheus