Socket
Socket
Sign inDemoInstall

pm2-webhook-monitor

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pm2-webhook-monitor - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

29

index.js
const pm2 = require( 'pm2' );
const pmx = require( 'pmx' );
const bent = require( 'bent' );
const os = require( 'os' );

@@ -18,2 +19,24 @@ const moduleConfig = pmx.initModule();

function getLocalIpAddress() {
let result;
const network = os.networkInterfaces();
for ( let key in network ) {
const networkUnit = network[ key ];
networkUnit.map( ( item ) => {
if ( item.family === 'IPv4' && !item.internal ) {
result = item.address;
}
} );
}
if ( !result ) {
result = 'Unknown IP Address';
}
return result;
}
function notify( message ) {

@@ -34,3 +57,5 @@ const requestJson = bent( 'json', {

const keywordList = [
`应用名称:${ message.name }`, `事件类型:${ message.event }`
`IP 地址:${ getLocalIpAddress() }`,
`应用名称:${ message.name }`,
`事件类型:${ message.event }`
];

@@ -64,3 +89,3 @@

if ( process.exec_mode === 'cluster_mode' && process.instances > 1 ) {
if ( process.exec_mode === 'cluster_mode' ) {
result += `[${ process.pm_id }]`;

@@ -67,0 +92,0 @@ }

2

package.json
{
"name": "pm2-webhook-monitor",
"version": "1.0.0",
"version": "1.0.1",
"description": "A pm2 monitor which sends log messages to webhook url.",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc