pm2-notifier

PM2 notifier. Sending notifications via DingTalk or Feishu.

Usage no npm install needed!

<script type="module">
  import pm2Notifier from 'https://cdn.skypack.dev/pm2-notifier';
</script>

README

PM2 Notifier

Supported Messaging Tools

  • DingTalk (钉钉)
  • Feishu (飞书)

Installation

pm2 install pm2-notifier

Usage

Config

Option Type Required Default
events string[] no ['log:err', 'process:exception', 'process:event']
polling number no 10000 (ms)
max_polling_time number no 60000 (ms)
dingtalk object no
- access_token string yes
- secret string yes
- at_mobiles string[] no
- at_all boolean no false
- enable boolean no true
feishu object no
- access_token string yes
- enable boolean no true

Example

Add environment variables in your ecosystem file, here is an example write in yaml format.

apps:
  - script: ./main.js
    name: app
    env_notifier:
      events:
        - log:err
        - process:event
      dingtalk:
        access_token: # your dingtalk access token
        secret: # your dingtalk secret
        at_all: true
      feishu:
        access_token: # your feishu access token
        enable: false # disable feishu notification

Now, start your processes with pm2 start ecosystem.config.yml.

License

MIT

Copyright (c) 2020, Acathur