LibreNMS 加入 Telegram 進行異常通報,請用本文依序操作。
> 手機下載並加入 Telegram。
> Telegram 加入 BotFather 為好友。
> 與 BotFather 的聊天室中輸入 /new bot,接著輸入聊天機器人的 Chatbot name 及 username。
> 完成後,BotFather 會回覆下面訊息。
==============================================
Done! Congratulations on your new bot. You will find it at t.me/chatbot_workshop_bot. You can now add a description, about section and profile picture for your bot, see /help for a list of commands. By the way, when you've finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this.
Use this token to access the HTTP API:
654321375:AIGv_TKLdIGRc_v9toTW_X0Z-dev_1tG-BP
For a description of the Bot API, see this page: https://core.telegram.org/bots/api
==============================================
> 上面紅字位置則是建立的 token。
> 先用 Telegram 加入剛剛建立的聊天機器人,然後稍微聊幾句。
> 以下面網址使用剛剛取得的 token 替換 $token,貼到瀏覽器上並執行。
https://api.telegram.org/bot{$token}/getUpdates
> 就會在瀏覽器上取得下面回應。
==============================================
{"ok":true,"result":[{"update_id":413586746,
"message":{"message_id":1,"from":{"id":1159753085,"is_bot":false,"first_name":"H","last_name":"Xai Xin","username":"e4568520","language_code":"zh-hans"},"chat":{"id":1159753085,"first_name":"H","last_name":"Xai Xin","username":"e4568520","type":"private"},"date":1147896322,"text":"/start","entities":[{"offset":0,"length":6,"type":"bot_command"}]}},{"update_id":413586747,
"message":{"message_id":2,"from":{"id":1159753085,"is_bot":false,"first_name":"H","last_name":"Xai Xin","username":"e4568520","language_code":"zh-hans"},"chat":{"id":1159753085,"first_name":"H","last_name":"Xai Xin","username":"e4568520","type":"private"},"date":1147896323,"text":"Hi"}}]}
==============================================
> 上面紅字位置則是聊天室的 Chat ID。
> 將 Chat ID 跟 token 記錄下來。
> 由 LibreNMS 頂端功能表的 [Alerts] -> [Alert Transports] 進入,並點選 [Create alert transport] 按鈕進入新增介面。
> 選擇 Telegram 再填入剛剛紀錄的 Chat ID 跟 token 即可。
沒有留言:
張貼留言