diff options
author | mal <mal@sec.gd> | 2019-10-21 15:03:54 +0000 |
---|---|---|
committer | thiagoftsm <thiagoftsm@gmail.com> | 2019-10-21 15:03:54 +0000 |
commit | 71af23f9957c87e2b240142fe3e8f92031aed711 (patch) | |
tree | a2875bacf7344046782fe481d0720a9c362423ca /health | |
parent | 7ea174c73919cf72a67afd56648f496417a38474 (diff) |
telegram: fix broken links, add setup instructions (#7033)
* Fix broken telegram bot link, tidy comments
The web documentation refers to `@myidbot`, which works. `@get_id` is currently a useless channel.
* Add telegram notification setup instructions
Diffstat (limited to 'health')
-rwxr-xr-x | health/notifications/health_alarm_notify.conf | 10 | ||||
-rw-r--r-- | health/notifications/telegram/README.md | 33 |
2 files changed, 31 insertions, 12 deletions
diff --git a/health/notifications/health_alarm_notify.conf b/health/notifications/health_alarm_notify.conf index 955dd25b59..5540dfc134 100755 --- a/health/notifications/health_alarm_notify.conf +++ b/health/notifications/health_alarm_notify.conf @@ -364,10 +364,7 @@ DEFAULT_RECIPIENT_KAVENEGAR="" #------------------------------------------------------------------------------ # telegram (telegram.org) global notification options -# To get your chat ID send the command /my_id to telegram bot @get_id. -# Users also need to open a query with the bot (see below). - -# note: multiple recipients can be given like this: +# multiple recipients can be given like this: # "CHAT_ID_1 CHAT_ID_2 ..." # enable/disable sending telegram messages @@ -377,7 +374,10 @@ SEND_TELEGRAM="YES" # Without it, netdata cannot send telegram messages. TELEGRAM_BOT_TOKEN="" -# If a role's recipients are not configured, a message will be send to +# To get your chat ID send the command /getid to telegram bot @myidbot +# (https://t.me/myidbot). Each user also needs to open a conversation with the +# bot that will be sending notifications. +# If a role's recipients are not configured, a message will be sent to # this chat id (empty = do not send a notification for unconfigured roles): DEFAULT_RECIPIENT_TELEGRAM="" diff --git a/health/notifications/telegram/README.md b/health/notifications/telegram/README.md index 981030efd1..45a2beaa8d 100644 --- a/health/notifications/telegram/README.md +++ b/health/notifications/telegram/README.md @@ -2,20 +2,39 @@ [Telegram](https://telegram.org/) is a messaging app with a focus on speed and security, itβs super-fast, simple and free. You can use Telegram on all your devices at the same time β your messages sync seamlessly across any number of your phones, tablets or computers. -With Telegram, you can send messages, photos, videos and files of any type (doc, zip, mp3, etc), as well as create groups for up to 30,000 people or channels for broadcasting to unlimited audiences. You can write to your phone contacts and find people by their usernames. As a result, Telegram is like SMS and email combined β and can take care of all your personal or business messaging needs. +With Telegram, you can send messages, photos, videos and files of any type (doc, zip, mp3, etc), as well as create groups for up to 100,000 people or channels for broadcasting to unlimited audiences. You can write to your phone contacts and find people by their usernames. As a result, Telegram is like SMS and email combined β and can take care of all your personal or business messaging needs. Netdata will send warning messages without vibration. -You need: +You need to: -1. A bot token. To get one, contact the [@BotFather](https://t.me/BotFather) bot and send the command `/newbot`. Follow the instructions. -2. A chat id for every chat you want to send messages to. Contact the [@myidbot](https://t.me/myidbot) bot and send the command `/getid` to get your personal chat id or invite him into a group and issue the same command to get the group chat id. -3. Start a conversation with your bot or invite him into a group you want to sent messages to. +1. Get a bot token. To get one, contact the [@BotFather](https://t.me/BotFather) bot and send the command `/newbot`. Follow the instructions. +2. Start a conversation with your bot or invite it into a group where you want it to send messages. +3. Find the chat ID for every chat you want to send messages to. Contact the [@myidbot](https://t.me/myidbot) bot and send the `/getid` command to get your personal chat ID or invite it into a group and use the `/getgroupid` command to get the group chat ID. Group IDs start with a hyphen, supergroup IDs start with `-100`. + Alternatively, you can get the chat ID directly from the bot API. Send *your* bot a command in the chat you want to use, then check `https://api.telegram.org/bot{YourBotToken}/getUpdates`, eg. `https://api.telegram.org/bot111122223:7OpFlFFRzRBbrUUmIjj5HF9Ox2pYJZy5/getUpdates` -See slack for configuration. +``` +SEND_TELEGRAM="YES" +TELEGRAM_BOT_TOKEN="111122223:7OpFlFFRzRBbrUUmIjj5HF9Ox2pYJZy5" +DEFAULT_RECIPIENT_TELEGRAM="-100233335555" +``` + +You can define multiple recipients like this: `"-100311112222 212341234|critical"`. +This example will send: + +- All alerts to the group with ID -100311112222 +- Critical alerts to the user with ID 212341234 + +You can give different recipients per **role** using these (in the same file): + +``` +role_recipients_telegram[sysadmin]="212341234" +role_recipients_telegram[dba]="-1004444333321" +role_recipients_telegram[webmaster]="49999333322 -1009999222255" +``` Telegram messages look like this: -![image](https://fb.hash.works/ytl/preview.jpg) +![Netdata notifications via Telegram](https://user-images.githubusercontent.com/1153921/66612223-f07dfb80-eb75-11e9-976f-5734ffd93ecd.png) [![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fhealth%2Fnotifications%2Ftelegram%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)](<>) |