moira-alert/moira

Не отправляются нотификации в приватные каналы по chat_id

proffust opened this issue · 0 comments

BUG REPORT

What version of Moira are you using ([binary] --version)?

$ api --version
docker exec -ti moira_api_1 api --version
Moira Api
Version: 2.5.1.0
Git Commit: 167fa10460980741ae0c6cf90e39aa56bea077b1
Go Version: go1.13.1
$ checker --version
docker exec -ti moira_checker_1 checker --version
Moira Checker
Version: 2.5.1.0
Git Commit: 167fa10460980741ae0c6cf90e39aa56bea077b1
Go Version: go1.13.1
$ cli --version

$ filter --version
docker exec -ti moira_filter_1 filter --version
Moira Filter
Version: 2.5.1.0
Git Commit: 167fa10460980741ae0c6cf90e39aa56bea077b1
Go Version: go1.13.1
$ notifier --version
docker exec -ti moira_notifier_1 notifier --version
Moira Notifier
Version: 2.5.1.0
Git Commit: 167fa10460980741ae0c6cf90e39aa56bea077b1
Go Version: go1.13.1

Configuration

api.yaml

redis:
  host: redis
  port: "6379"
  dbid: 0
graphite:
  enabled: true
  runtime_stats: false
  uri: "192.168.226.166:2003"
  prefix: carbon.agents.moira.{hostname}
  interval: 10s
api:
  listen: ":8081"
  enable_cors: false
  web_config_path: "/etc/moira/web.json"
web:
  # Moira administrator email address
  supportEmail: "devops@example.com"
  # List of enabled contact types
  contacts:
    - type: mail
      label: E-mail
      validation: "^.+@.+\\..+$"
    - type: pushover
      label: Pushover
      placeholder: "Pushover user key"
    - type: slack
      label: Slack
      validation: "^[@#][a-zA-Z0-9-_]+"
      placeholder: "Slack #channel or @user"
    - type: telegram
      label: Telegram
      placeholder: "#channel, @username or group"
      help: "### To make things work you should:\n### In personal chat:\n - start conversation with bot [@zabbix_syslocal_bot](https://t.me/zabbix_syslocal_bot);\n - execute command `/start`;\n - type your login in above field as `@login`.\n\n### In group chat:\n - invite bot [@zabbix_syslocal_bot](https://t.me/zabbix_syslocal_bot) into chat;\n - execute command `/start@zabbix_syslocal_bot`;\n - bot will send you chat name, you should type it without extra characters in above field.\n\n### In channel:\n - add bot [@zabbix_syslocal_bot](https://t.me/zabbix_syslocal_bot) into channel;\n - promote bot as channel administrator;\n - type channel name in above field as `#channel`.\n"
    - type: twilio sms
      label: Twilio SMS
      validation: "^\\+79\\d{9}$"
      placeholder: "Phone number format +79*********"
    - type: twilio voice
      label: Twilio voice
      validation: "^\\+79\\d{9}$"
      placeholder: "Phone number format +79*********"
    - type: webhook
      label: My Webhook
      validation: "^(http|https):\\/\\/.*(example.com|example.org)(:[0-9]{2,5})?\\/"
      placeholder: "https://example.com/webhooks/moira"
      help: "### Domains whitelist:\n - example.com\n - example.org"
    - type: pagerduty
      label: PagerDuty
      placeholder: "Integration key"
    - type: opsgenie
      label: OpsGenie
      placeholder: "Responder Name or ID"
    - type: victorops
      label: VictorOps
      placeholder: "Routing key"
    - type: discord
      label: Discord
      placeholder: "Discord channel (eg: general-text) or user (eg: @user)"
remote:
  enabled: true
  url: "http://metrics.sys.local:8082/render"
  check_interval: 60s
  timeout: 60s
log:
  log_file: stdout
  log_level: info

checker.yaml

redis:
  host: redis
  port: "6379"
  dbid: 0
graphite:
  enabled: true
  runtime_stats: false
  uri: "192.168.226.166:2003"
  prefix: carbon.agents.moira.{hostname}
  interval: 10s
checker:
  nodata_check_interval: 60s
  check_interval: 30s
  metrics_ttl: 3h
  stop_checking_interval: 30s
remote:
  enabled: false
  url: "http://metrics.sys.local:8082/render"
  check_interval: 60s
  timeout: 60s
log:
  log_file: stdout
  log_level: info

cli.yaml

filter.yaml

redis:
  host: redis
  port: "6379"
  dbid: 0
graphite:
  enabled: true
  runtime_stats: false
  uri: "192.168.226.166:2003"
  prefix: carbon.agents.moira.{hostname}
  interval: 10s
filter:
  listen: ":2003"
  retention_config: /etc/moira/storage-schemas.conf
  cache_capacity: 10
  max_parallel_matches: 0
log:
  log_file: stdout
  log_level: info

notifier.yaml

#See https://moira.readthedocs.io/en/latest/installation/configuration.html for config explanation
redis:
  host: redis
  port: "6379"
  dbid: 0
graphite:
  enabled: true
  runtime_stats: false
  uri: "192.168.226.166:2003"
  prefix: carbon.agents.moira.{hostname}
  interval: 10s
remote:
  enabled: false
  timeout: 60s
notifier:
  sender_timeout: 10s
  resending_timeout: "1:00"
  senders:
    - type: mail
      mail_from: moira@sys.local
      smtp_host: XXXXXXXXXXXXXXX
      smtp_port: XXXX
      # Skip SMTP server certificate chain validation if false
      insecure_tls: true
      template_file: '/etc/moira/fancy-template.html'
    - type: telegram
      api_token: XXXXXXXXXXXXXXXXXXXXXXX
  moira_selfstate:
    enabled: true
    remote_triggers_enabled: false
    redis_disconect_delay: 60s
    last_metric_received_delay: 120s
    last_check_delay: 900s
    last_remote_check_delay: 900s
    notice_interval: 300s
    contacts:
      - type: mail
        value: denis.ustinov@rt.ru
  front_uri: http://moira.sys.local
  timezone: Europe/Moscow
  date_time_format: "15:04 02.01.2006"
log:
  log_file: stdout
  log_level: info

What did you expect to see?

Добавляю канал оповещения, указав туда chat_id приватного канала, при нажатии на test тестовое сообщение не отправляется. В логе при этом

2020-07-24 10:35:02.595 notifier        DEBUG   Start sending package of 1 notifications to #-1001185159845
2020-07-24 10:35:02.595 notifier        DEBUG   Calling telegram api with chat_id #-1001185159845 and message body 😊TEST   (1)
13:13: Test.metric.value = 1 (TEST to TEST)
2020-07-24 10:35:02.678 notifier        WARNING Can't send message after 22 try: can't find recipient @-1001185159845: api error: Bad Request: chat not found. Retry again after 1 min
2020-07-24 10:35:02.678 notifier        DEBUG   Scheduled notification for contact telegram:#-1001185159845 trigger  at 2020/07/24 10:36:02 (1595586962)
2020-07-24 10:35:03.473 notifier        DEBUG   Getting contactID 7d68439a-6c2d-404e-94b9-05e97656942f for test message
2020-07-24 10:35:03.475 notifier        DEBUG   Scheduled notification for contact telegram:-1001185159845 trigger  at 2020/07/24 10:35:03 (1595586903)
2020-07-24 10:35:03.593 notifier        DEBUG   Start sending package of 1 notifications to -1001185159845
2020-07-24 10:35:03.593 notifier        DEBUG   Calling telegram api with chat_id -1001185159845 and message body 😊TEST   (1)
13:35: Test.metric.value = 1 (TEST to TEST)
2020-07-24 10:35:03.598 notifier        WARNING Can't send message after 0 try: failed to get username uuid: nil returned. Retry again after 1 min
2020-07-24 10:35:03.599 notifier        DEBUG   Scheduled notification for contact telegram:-1001185159845 trigger  at 2020/07/24 10:36:03 (1595586963)
2020-07-24 10:35:05.600 notifier        INFO    Moira Self State Monitoring acquired the lock
2020-07-24 10:35:05.600 notifier        INFO    Moira Notifier Self State Monitor started
2020-07-24 10:35:09.591 notifier        DEBUG   Start sending package of 1 notifications to -1001292969243

What did you see instead?

При указании chat_id отправлять именно по нему