metalmatze / alertmanager-bot

[deprecated] Bot for Prometheus' Alertmanager
MIT License
661 stars 148 forks source link

Starting Container #89

Closed SamyaMaiti2012 closed 4 years ago

SamyaMaiti2012 commented 4 years ago

Hi All,

After staring the docker container it stops immediately with no logs except below. must be a very basic mistake from my end. but stuck.

docker run -d \
    -e 'ALERTMANAGER_URL=http://0.0.0.0:9093' \
    -e 'BOLT_PATH=/data/bot.db' \
    -e 'STORE=bolt' \
    -e 'LISTEN_ADDR=0.0.0.0:8080' \
    -e 'TELEGRAM_ADMIN=xxxxxxxxxx' \
    -e 'TELEGRAM_TOKEN=XXXXXXXX:XXXXXXXXXXX' \
    -v 'telegram_data:/data' \
    --name alertmanager-bot \
    metalmatze/alertmanager-bot:0.4.0

Log in Docker container before stoping

Flags:,
  -h, --help                     Show context-sensitive help (also try,
                                 --help-long and --help-man).,
      --alertmanager.url=ALERTMANAGER.URL  ,
                                 The URL that's used to connect to the,
                                 alertmanager,
      --bolt.path=BOLT.PATH      The path to the file where bolt persists its,
                                 data,
      --consul.url=CONSUL.URL    The URL that's used to connect to the consul,
                                 store,
      --listen.addr=LISTEN.ADDR  The address the alertmanager-bot listens on for,
                                 incoming webhooks,
      --log.json                 Tell the application to log json and not key,
                                 value pairs,
      --log.level=info           The log level to use for filtering logs,
      --store=STORE              The store to use,
      --telegram.admin=TELEGRAM.ADMIN ...  ,
                                 The ID of the initial Telegram Admin,
      --telegram.token=TELEGRAM.TOKEN  ,
                                 The token used to connect with Telegram,
      --template.paths=./default.tmpl ...  ,
                                 The paths to the template

Regards, Samya

mator commented 4 years ago

i can't run container as well. starting it by docker run (with proper command line , like in the README example), makes container exit immediately after start. Logs:

# docker ps -a
CONTAINER ID        IMAGE                         COMMAND                  CREATED              STATUS                          PORTS                    NAMES
bf5cfc6554df        metalmatze/alertmanager-bot   "/usr/bin/alertmanag…"   About a minute ago   Exited (2) About a minute ago                            alertmanager-bot

$ journalctl -u docker -e
error parsing commandline arguments: path './default.tmpl' does not exist
usage: alertmanager-bot --alertmanager.url=ALERTMANAGER.URL --listen.addr=LISTEN.ADDR --store=STORE --telegram.ad

# docker images
REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE
metalmatze/alertmanager-bot   latest              ea92091f4ae5        10 months ago       20.6MB

how do i pass default.tmpl to a container on a run ?

Thanks.

PS: Was able to run container from git version of repo. Subscribing for alerts, they does not come to me (as a message), though i see them in /alerts as firing (as well OK messages does not arrive too). Was unable to add second bot admin via docker run -e "TELEGRAM_ADMIN=$id1\n$id2" ... , container failed to start. It would be better to be able to manage admins via /command interface (like /admins add/rm/list)

metalmatze commented 4 years ago

The default for the --template.paths flag was broken at the time of the 0.4.0 release. It was fixed in https://github.com/metalmatze/alertmanager-bot/pull/76 and I will cut a 0.4.1 release that is going to include this fix. Sorry about the inconvenience.