Skip to content
This repository has been archived by the owner on Aug 14, 2022. It is now read-only.

Runing bot #26

Open
metaesAJ opened this issue Aug 20, 2018 · 8 comments
Open

Runing bot #26

metaesAJ opened this issue Aug 20, 2018 · 8 comments

Comments

@metaesAJ
Copy link

Hello, when i'm trying to start bot with docker-compose file i see :
level=error ts=2018-08-20T15:21:44.274865Z caller=main.go:134 msg="failed to create bot" err="http.Post failed: Post https://api.telegram.org/bot678959762:AAHhfz2K-TSh_Ptij_k21iNFy4vTXQlDoIM/getMe: EOF"

compose file:
alertmanager-bot:
image: metalmatze/alertmanager-bot:0.2
environment:
ALERTMANAGER_URL: alertmanager:9093
BOLT_PATH: /data/bot.db
STORE: bolt
LISTEN_ADDR: 0.0.0.0:8080
TELEGRAM_ADMIN: '1234567'
TELEGRAM_TOKEN: "my token by botfather"
volumes:
- ./srv/monitoring/alertmanager-bot:/data

@metaesAJ
Copy link
Author

metaesAJ commented Aug 20, 2018

when i'm trying set admin i see that error :
error parsing commandline arguments: strconv.ParseFloat: parsing "my acc": invalid syntax usage: alertmanager-bot --alertmanager.url=ALERTMANAGER.URL --listen.addr=LISTEN.ADDR --store=STORE --telegram.admin=TELEGRAM.ADMIN --telegram.token=TELEGRAM.TOKEN [<flags>]

@metalmatze
Copy link
Owner

Did you manage to resolve this issue?

@tbpoetke
Copy link
Contributor

Had the same problem, solution is to use the ID Number for TELEGRAM_ADMIN. Its just a numeric value, use userinfobot to get the id

@lazysmokier
Copy link

lazysmokier commented Jan 30, 2019

One of the possible reasons may be ISP blocks traffic to telegram. You may use the following command to check if your system have trouble with connectivity to the telegram api:

curl -X POST https://api.telegram.org/bot<TELEGRAM_TOKEN>/getMe

@ihtiking
Copy link

This is for CentOS7 system instruction:

  1. Before build Docker image, i'm install 'golang' package:
    yum install -y golang

  2. Compile file main.go in path:
    go build ./cmd/alertmanager-bot/main.go ./cmd/alertmanager-bot/main

This is ready Dockerfile, which i'm edited:
FROM centos:7
ENV TEMPLATE_PATHS=default.tmpl
COPY ./cmd/alertmanager-bot/main /usr/bin/
COPY alpineentrypoint.sh /usr/bin/alertmanager-bot/
COPY default.tmpl /usr/bin/alertmanager-bot/
EXPOSE 8080
ENTRYPOINT ["/usr/bin/alertmanager-bot/alpineentrypoint.sh"]

In file alpineentrypoint.sh i write:
#!/bin/sh
/usr/bin/main.

Then we run image:
docker start alertmanagerbotimage
or we can simple run '/usr/bin/main' in command line.

Done. But, the next hope, run 'main' with key:

./main --alertmanager.url=localhost:9093 --listen.addr=localhost:10443 --store=bolt BOLT_PATH:/tmp/bot.db --telegram.admin=<id number, not text> --telegram.token= --template.paths=/root/alertmanager-bot/default.tmpl

Stay one problem:
alertmanager-bot: error: unexpected BOLT_PATH:/tmp/bot.db

Please, help. What binary-script want?

@tazhate
Copy link

tazhate commented Jan 18, 2020

@ihtiking you should pass BOLT_PATH in another way i think, like option.

@isac-seven
Copy link

I'm having the following error using K8s deployment:
caller=main.go:215 component=telegram msg="failed to create bot" err="http.Post failed: parse https://api.telegram.org/REDACTED\n/getMe: net/url: invalid control character in URL"

Seems like a '\n' in being appended somewhere to my bot token 🤔

@isac-seven
Copy link

Oh, just found the solution at kubernetes/kubernetes#23404 (comment) !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants