pm2-telegram-notification
v0.4.0
Published
Update pm2 Status in Telegram
Readme
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>/getUpdatesapi
- 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_IDif its a group chat id append
g-eg:
group chat CHAT_ID =
123456->g-123456personal 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 serverbot_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 trueerror= enabled alerts for error handlers exposed by pm2, default is trueerror_log= flag configuration to truncate log with ref-id above 3500 characters with a trace in logs annotated with that ref-id, default is trueviolation_time= time interval gap in which if another alerts occurs is said to count as violation, default is 10000violation_count= violation count limit after which the notification is delayed with debounce time, default is 8debounce= delay/debounce time applied in milliseconds to notification in case if violation count limit is reached, default is 30000
