Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set Prometheus Alertmanager external URL via configuration

I'm using a vanilla Docker container to start an Alertmanager. As far as I know, I cannot provide the external URL via parameter in this case, so I have to find another way.

Is it possible to set the URL via configuration file or environment variable?

like image 546
eventhorizon Avatar asked Dec 19 '17 11:12

eventhorizon


People also ask

Which are the external systems Prometheus Alertmanager supports to notify?

The Alertmanager handles alerts sent by client applications such as the Prometheus server. It takes care of deduplicating, grouping, and routing them to the correct receiver integration such as email, PagerDuty, or OpsGenie. It also takes care of silencing and inhibition of alerts.


2 Answers

I achieved it with docker-compose. This is the configuration I used for the alertmanager.

version: "2"

services:
  alertmanager:
    image: "prom/alertmanager"
    hostname: "alertmanager"
    restart: always
    volumes:
      - ./alertmanager:/alertmanager
      - ./alertmanager.yml:/etc/alertmanager/config.yml
      - ./templates:/etc/alertmanager/templates
    ports:
      - "9093:9093"
    command: 
      - "--config.file=/etc/alertmanager/config.yml"
      - "--storage.path=/alertmanager" 
      - "--web.external-url=http://clms-lab.dev-gr.clmsuk.com:9093"
    labels:
      NAME: "monitor"
like image 64
theofilis Avatar answered Oct 15 '22 18:10

theofilis


Just to generalize the answer given by @theofilis for those not using Docker, you can achieve this by setting the "--web.external-url" flag when starting AlertManager, e.g.

./alertmanager --config.file=alertmanager.yml --web.external-url=http://example.com:9093
like image 45
A. Fleming Avatar answered Oct 15 '22 19:10

A. Fleming