Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
pm2-webhook-monitor
Advanced tools
This is a pm2 module which monitors application processes and sends log messages of specified events, exceptions and errors.
At the first, I want to monitor my application and I want a program which can notify me on WeChat when my application crashes. But, for some reason, I have to implement this by a private webhook url. So this module is only works for me. If you want to use a public webhook url (e.g. WeChat webhook) or your own private url, you can fork this module and implement your own notify
function in notifier.js
. It's very easy.
You should install this module first:
pm2 install pm2-webhook-monitor
To get this module work, you need to tell it your webhook url:
pm2 set pm2-webhook-monitor:webhookUrl < https://www.webhook.com/notify.action >
And for my case, I use phone numbers to specify the people who will receive the notification. It could be set like this:
pm2 set pm2-webhook-monitor:phone "13000000000,13000000001"
Here are the all configuration items and their default value.
{
"webhookUrl" : null,
"log" : false,
"error" : true,
"kill" : true,
"exception" : true,
"restart" : true,
"reload" : true,
"delete" : true,
"stop" : true,
"restart overlimit" : true,
"exit" : false,
"start" : false,
"online" : false,
"phone" : null,
"bufferMaxSecond" : 5,
"buffer" : true
}
You can config them by using:
pm2 set pm2-webhook-monitor:<key> <value>
When our application is executed in cluster mode, there will be many processes. And if we restart the application, every process will trigger a restart
event and all the events will be notified to us. I think this is unnecessary and use a message queue to avoid this behaviour.
The message queue receives messages and merges the same event. Then it uses a scheduler to finish the notify task.
We can enable this by set:
pm2 set pm2-webhook-monitor:buffer true
And the bufferMaxSecond
specifies how long should the monitor program buffer the messages. The default value is 5, which means the message queue waits at most 5 seconds while the first message is arrived. Once the waiting time is over the limit, the notify task is executed immediately.
pm2-slack : This project inspired me to create this module, thanks to every one contributes to this project, thanks for their hard-working and open source spirit.
sailor103 : This is one of my best friends, he introduced the pm2-slack
project to me, and he often plays the duck role in my rubber duck debugging. Thanks for his time and love(just love between friends, I'm not a gay, but I'm not sure if he is a gay :smirk: ).
FAQs
A pm2 monitor which sends log messages to webhook url.
The npm package pm2-webhook-monitor receives a total of 0 weekly downloads. As such, pm2-webhook-monitor popularity was classified as not popular.
We found that pm2-webhook-monitor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.