LINUX.ORG.RU

prometheus alertmanager telegram

 , ,


0

2

настроил уведомления в slack, хочу добавить, что бы еще в телеграм приходили уведомления, установил этот бот и запустил

tcp6       0      0 :::9087                 :::*                    LISTEN      12549/prometheus_bot

добавляю в конфиг altermanager

route:
    receiver: 'slack'

route:
    receiver: 'telegram'

receivers:
    - name: 'slack'
      slack_configs:
          - send_resolved: true
            text: "{{ .CommonAnnotations.description }}"
            username: 'Prometheus'
            channel: '#prometheus'
            api_url: 'https://hooks.slack.com/services/myhook'

receivers: 'telegram'
    - name: 'telegram'
      webhook_configs:
          - send_resolved: true
             url: http://127.0.0.1:9087/alert/id_chat

но при запуске ругается

level=info ts=2019-03-26T12:32:50.038918999Z caller=main.go:334 msg="Loading configuration file" file=./config.yml
level=error ts=2019-03-26T12:32:50.039110011Z caller=main.go:337 msg="Loading configuration file failed" file=./config.yml err="yaml: line 16: did not find expected key"
level=info ts=2019-03-26T12:32:50.039168891Z caller=cluster.go:641 component=cluster msg="gossip not settled but continuing anyway" polls=0 elapsed=15.564931ms

на 16 строку - receivers: 'telegram'

подскажите что не так или поделитесь готовым конфигом или примером?



Последнее исправление: Garcia (всего исправлений: 2)

Ответ на: комментарий от deadNightTiger

убирал, приводил к такому виду

route:
    receiver: 'slack'

route:
    receiver: 'telegram'

receivers:
    - name: 'slack'
      slack_configs:
          - send_resolved: true
            text: "{{ .CommonAnnotations.description }}"
            username: 'Prometheus'
            channel: '#prometheus'
            api_url: 'https://hooks.slack.com/services/myhook'

    - name: 'telegram'
      webhook_configs:
          - send_resolved: true
            url: http://127.0.0.1:9087/alert/id_chat

ругается на второй route

level=info ts=2019-03-26T11:42:58.102633444Z caller=main.go:334 msg="Loading configuration file" file=./config.yml
level=error ts=2019-03-26T11:42:58.102866447Z caller=main.go:337 msg="Loading configuration file failed" file=./config.yml err="yaml: unmarshal errors:\n  line 4: field route already set in type config.plain"
level=info ts=2019-03-26T11:42:58.102954548Z caller=cluster.go:641 component=cluster msg="gossip not settled but continuing anyway" polls=0 elapsed=25.329535ms

Garcia
() автор топика
Ответ на: комментарий от GOMO88
route:
    receiver: 'slack'

receivers:
    - name: 'slack'
      slack_configs:
          - send_resolved: true
            text: "{{ .CommonAnnotations.description }}"
            username: 'Prometheus'
            channel: '#prometheus'
            api_url: 'https://hooks.slack.com/services/T1AGW16JF/B1B08MP6C/myhook'

receivers:
    - name: 'telegram'
      webhook_configs:
          - send_resolved: true
            url: http://127.0.0.1:9087/alert/id_chat
./promtool check config config.yml
Checking config.yml
  FAILED: parsing YAML file config.yml: yaml: unmarshal errors:
  line 1: field route not found in type config.plain
  line 4: field receivers not found in type config.plain
  line 13: field receivers not found in type config.plain

что-то вообще не хочет

Garcia
() автор топика
Ответ на: комментарий от GOMO88

он даже на рабочий конфиг ошибки показывает

route:
    receiver: 'slack'

receivers:
    - name: 'slack'
      slack_configs:
          - send_resolved: true
            text: "{{ .CommonAnnotations.description }}"
            username: 'Prometheus'
            channel: '#prometheus'
            api_url: 'https://hooks.slack.com/services/myhook'

./promtool check config config.yml
Checking config.yml
  FAILED: parsing YAML file /root/docker/dockprom/alertmanager/config.yml: yaml: unmarshal errors:
  line 1: field route not found in type config.plain
  line 4: field receivers not found in type config.plain
Garcia
() автор топика
Последнее исправление: Garcia (всего исправлений: 1)
21 ноября 2019 г.
Ответ на: комментарий от Garcia

Ну там написано что у тебя что то с концом строки, заного отформатируй конфиг или посмотри где не правильный или лишний конец строки \n

anonymous
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.