webdevops / alertmanager2es

Collects alertmanager alerts and pushes them to ElasticSearch (fork from cloudflare)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to set environment for alertmanager2es docker?

Dhyanesh97 opened this issue · comments

Hi,

I am struggling to setup a docker for alertmanager2es. Is there any example to set environment variable to alertmanager2es like address, username, password and etc. ?
I need to send alerts to elastic cloud.

I have added below lines to docker but doesn't seems to be working

alertmanagere2e:
    image: webdevops/alertmanager2es
    container_name: alertmanagere2e
    restart: always
    networks:
      - analytics
    ports:
      - "9097:9097"
    command: ./alertmanager2es --elasticsearch.address="url:port/" --elasticsearch.username="username" --elasticsearch.password="password" --elasticsearch.index="alertmanager-2" 

Any help appreciated.

Even if I add the Env variables to secrets.env file it doesn't seems to work.

docker content

alertmanagere2e:
    image: webdevops/alertmanager2es
    container_name: alertmanagere2e
    restart: always
    networks:
      - analytics
    env_file:
      - secrets.env
    ports:
      - "9097:9097"

secrets.env

ELASTICSEARCH_ADDRESS="url:port"
ELASTICSEARCH_USERNAME=username
ELASTICSEARCH_PASSWORD=password
ELASTICSEARCH_INDEX="alertmanager-2"
SERVER_BIND=9097

@mblaschke Could you please help me with above issue ?

I was able to solve the issue by modifying the command in docker file as below
Need to bind with default port along with ":" worked.

command: ./alertmanager2es --elasticsearch.address="url:port/" --elasticsearch.username="username" --elasticsearch.password="password" --elasticsearch.index="alertmanager-2" --bind=:9097

I can reach /healthz and /metrics.
I can also reach to /webhook but received "unexpected end of JSON input" as response.