pm2-telegram-notification
An awesome tool to integrate pm2 notifications to your telegram chats!
Report Bug
·
Request Feature
What is pm2-telegram-notification ?
Send server logs to a telegram group/chat. works with pm2 process manager.
Installation
pm2 install pm2-telegram-notification
How to Use
Telegram setup
- create a telegram bot link
- add that bot to a group if you want to send logs to a group
- get chat_id
- to get chat_id use
https://api.telegram.org/bot<BOT_TOKEN>/getUpdates
api
- to get chat_id use
pm2-telegram-notification setup
- install pm2-telegram-notification
--
pm2 install pm2-telegram-notification
- configure bot token
--
pm2 set pm2-telegram-notification:bot_token BOT_TOKEN
- configure chat id
--
pm2 set pm2-telegram-notification:chat_id CHAT_ID
-
if its a group chat id append
g-
eg:
group chat CHAT_ID =
123456
->g-123456
personal chat CHAT_ID =
123456
->123456
-
- configure server name (optional)
--
pm2 set pm2-telegram-notification:server_name SERVER_NAME
- configure lifecycle (optional) default: true
--
pm2 set pm2-telegram-notification:lifecycle (true/false)
- configure error (optional) default: true
--
pm2 set pm2-telegram-notification:error (true/false)
- configure error_log (optional) default: true
--
pm2 set pm2-telegram-notification:error_log (true/false)
😎
Configuration definition -
server_name
= name of the server -
bot_token
= token generated with telegram as suggested in 'Telegram setup section' -
chat_id
= identifier corresponding to particular group or personal chat on which the notifications are expected to be posted, as explained in 'Telegram setup section' -
lifecycle
= enabled alerts for lifecycle event handlers exposed by pm2, default is true -
error
= enabled alerts for error handlers exposed by pm2, default is true -
error_log
= flag configuration to truncate log with ref-id above 3500 characters with a trace in logs annotated with that ref-id, default is true -
violation_time
= time interval gap in which if another alerts occurs is said to count as violation, default is 10000 -
violation_count
= violation count limit after which the notification is delayed with debounce time, default is 8 -
debounce
= delay/debounce time applied in milliseconds to notification in case if violation count limit is reached, default is 30000