metalmatze / alertmanager-bot

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

How to install it without docker? #116

Closed KOTOXJle6 closed 4 years ago

KOTOXJle6 commented 4 years ago

Hello!

Im trying to install bot and got some problems on ubuntu 20.04. Here is steps i've done:

1) Installed Go and run "GO111MODULE=on go get github.com/metalmatze/alertmanager-bot/cmd/alertmanager-bot"

2) Added to env TELEGRAM_ADMIN=id of my own telegram account and TELEGRAM_TOKEN=my bot's token

3) Edited config files prometheus.yml:

rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"
    - "alert.rules.yml"
    - "telegram.rules.yml"

telegram.rules.yml:

groups:
- name: ExporterDown
  rules:
  - alert: NodeDown
    expr: up{job='Node'} == 0
    for: 1m
    labels:
      severity: Error
    annotations:
      summary: "Node Explorer instance ($instance) down"
      description: "NodeExporterDown"

alertmanager.yml:

route:
  group_by: ['alertname', 'instance', 'severity']
  group_wait: 10s
  group_interval: 10s
  repeat_interval: 1h
  receiver: 'web.hook'

    - receiver: alertmanager-bot
      match:
        alertname: InstanceDown

receivers:
- name: alertmanager-bot
  webhook_configs:
  - send_resolved: true
    url: 'http://alertmanager-bot:8080'

Configs running without errors and other alerts works fine. If i run "sudo lsof -i -P -n | grep LISTEN", there is no 8080 port.

What am i doing wrong? Where i should enter chat id? Sorry if i created topic wrong way, didnt found any other discussions.

metalmatze commented 4 years ago

You can use the --listen.addr flag to specify the bind addr for the bot to create the HTTP server on: https://github.com/metalmatze/alertmanager-bot/blob/master/cmd/alertmanager-bot/main.go#L88-L91 By default that's 0.0.0.0:8080.