14

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?

Pang
  • 9,564
  • 146
  • 81
  • 122
eventhorizon
  • 2,977
  • 8
  • 33
  • 57

3 Answers3

17

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"
030
  • 10,842
  • 12
  • 78
  • 123
theofilis
  • 411
  • 5
  • 10
6

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
A. Fleming
  • 61
  • 1
  • 1
5

For whom trying to set it for the "plain" helm chart use the following values when installing / upgrading the chart:

extraArgs:
  web.external-url: "<http|https>://<your_host>/<your_base_path>"
  web.route-prefix: "/"
Giovanni Patruno
  • 651
  • 9
  • 15