0.4.0 • Published 3 years ago

pm2-telegram-notification v0.4.0

Weekly downloads
9
License
Apache License 2....
Repository
github
Last release
3 years ago

Bot API npm package Build Status Contributors Forks Stargazers Issues MIT License

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

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 errorlog (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
0.3.0

3 years ago

0.4.0

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago