Install Prometheus Alert Manager

Video Lecture

Install Prometheus Alert Manager Install Prometheus Alert Manager Install Prometheus Alert Manager

Description

Install the Prometheus Alert Manager

sudo apt install prometheus-alertmanager

It has started a new service called prometheus-alertmanager

sudo service prometheus-alertmanager status

It is also managed by the user prometheus

ps -u prometheus

Note that the service is running on port 9093

Visit http://[your domain name or ip]:9093/

Block Port 9093 for external requests

iptables -A INPUT -p tcp -s localhost --dport 9093 -j ACCEPT
iptables -A INPUT -p tcp --dport 9093 -j DROP
iptables -L

Warning

iptables settings will be lost in case of system reboot. You will need to reapply them manually,

or

install iptables-persistent

sudo apt install iptables-persistent

This will save your settings into two files called,

/etc/iptables/rules.v4

/etc/iptables/rules.v6

Any changes you make to the iptables configuration won't be auto saved to these persistent files, so if you want to update these files with any changes, then use the commands,

iptables-save > /etc/iptables/rules.v4

iptables-save > /etc/iptables/rules.v6

Check the endpoint in the prometheus.yml is correctly set for the location of your Alertmanager.

sudo nano /etc/prometheus/prometheus.yml

Mine is set to the Alertmanager running locally on localhost:9093

...
# Alertmanager configuration
alerting:
  alertmanagers:
  - static_configs:
    - targets: ['localhost:9093']
...

You can optionally also add the Alertmanager metrics endpoint to be scraped by prometheus as well so that you can monitor its performance.

scrape_configs:
  ...

  - job_name: alertmanager
    static_configs:
      - targets: ['localhost:9093']

Prometheus Alertmanager

Alertmanager Configuration