Unitech / pm2

Node.js Production Process Manager with a built-in Load Balancer.
https://pm2.keymetrics.io/docs/usage/quick-start/
Other
41.31k stars 2.61k forks source link

Question: Can PM2 send notifications or launch an arbitrary script when a process dies? #2772

Closed cosmicscr closed 7 years ago

cosmicscr commented 7 years ago

Hi, I've been googling around, looking through pm2 docs, and looking through github issues but can't seem to find an answer to this question:

Is there a way for pm2 to launch an arbitrary script when a process that it is monitoring crashes? I understand that pm2 can automatically restart the process, but can it also launch a script?

The purpose is for notifications. When a process dies in production, what is the best practice way of sending alerts or notifications using pm2?

Thanks for any advice!

vmarchaud commented 7 years ago

Two solutions :

psifertex commented 6 years ago

Just to clarify, it appears the free tier of keymetrics does not support any notifications, so it requires a minimum of $360/yr to use keymetrics to add notifications.