How to set Prometheus Alertmanager external URL via configuration

eventhorizon picture eventhorizon · Dec 19, 2017 · Viewed 7.1k times · Source

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?

Answer

theofilis picture theofilis · Jun 20, 2018

I achieved it with docker-composer. 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"