This module is deprecated.
Use instead: http://pm2.keymetrics.io/docs/usage/pm2-api/
Deprecated
License: Other
This module is deprecated.
Use instead: http://pm2.keymetrics.io/docs/usage/pm2-api/
Hy, I tried broadcasting a message as you say in your example
process.emit({ type : 'my:message', data : {}})
but the
ipm2.bus.on('*', function(event, data){ .... } );
does not catch it.
I issued "pm2 logs" and triggered the broadcast, and theres nothing in the logs
Edit:
I launched the application with "pm2 start entry.js -i 2"
This is a reduced case from a larger piece of code that hangs with 100% cpu usage by node when pm2 is not installed. The setInterval runs once (usually) and then things hang up at 100% cpu. If pm2 is installed, the code does not hang or if node 0.10.29 and earlier are used it does not hang.
var ipm2 = require('pm2-interface')();
var interval = setInterval( function () {
console.log("FIRED");
}, 500);
I'm not deliberately trying to use pm2-interface when pm2 is not installed but my code is auto-detecting to see if pm2 is being used or cluster2 module. The ipm2 line is at the top of the module and is unconditionally executed so I can avoid the problem by moving the line so the execution only happens if pm2 is around. Nevertheless, I wanted to report this because I don't know what changed in node 0.10.30 and whatever did it may pop up in other circumstances. I will also report it to the node issues.
subj
Why "You shouldn't use this module"? I think it's a very useful module for me to monitor my processes and catch notifications.
And I didn't find a way to send notifications between processes using pm2 module in your suggestion.
(and also it's small enough)
Is there any chance of getting a method that returns the version of pm2 a given instance of pm2-interface is connected to? It'd be quite useful to prompt users to upgrade pm2 when new features are added.
Right now, any client can connect to pm2-interface, invoke RPCs and receive events.
Some sort of authentication mechanism is necessary in order to prevent rogue clients wreaking havoc on production systems.
Either public keys, passwords over SSL, encrypted tokens or similar would do the trick.
Or should this go into axon/axon-rpc instead?
The version of pm2-interface on npm is 1.1.0 yet the version in the repository is 0.1.3 - could you please push the new code to the repo so we can easily see what has changed?
full rpc object trace:
rpc:
{ prepare: [Function],
prepareJson: [Function],
getMonitorData: [Function],
getSystemData: [Function],
startProcessId: [Function],
stopProcessId: [Function],
stopProcessName: [Function],
stopAll: [Function],
softReloadProcessId: [Function],
reloadProcessId: [Function],
killMe: [Function],
findByScript: [Function],
findByPort: [Function],
findByFullPath: [Function],
restartProcessId: [Function],
restartProcessName: [Function],
deleteProcessName: [Function],
deleteProcessId: [Function],
msgProcess: [Function],
deleteAll: [Function],
ping: [Function],
sendSignalToProcessId: [Function],
sendSignalToProcessName: [Function],
getVersion: [Function],
reloadLogs: [Function],
stopWatch: [Function],
restartWatch: [Function] },
I'm trying some very basic, and form some reason the 'ready' event never fires. I have no idea what the deal is and there are no errors in the logs. How can I find out what's going on?
# pm2 start test.js
Starting PM2 daemon...
[PM2] Process test.js launched
┌──────────┬────┬──────┬──────┬────────┬───────────┬────────┬─────────────┬─────────────┐
│ App name │ id │ mode │ PID │ status │ restarted │ uptime │ memory │ watching │
├──────────┼────┼──────┼──────┼────────┼───────────┼────────┼─────────────┼─────────────┤
│ test │ 0 │ fork │ 9236 │ online │ 0 │ 0s │ 15.273 MB │ unactivated │
└──────────┴────┴──────┴──────┴────────┴───────────┴────────┴─────────────┴─────────────┘
Use `pm2 desc[ribe] <id>` to get more details
# pm2 logs
########### Starting streaming logs for [all] process
[PM2] is being killed via kill method
[PM2] killing PM2 via Satan
[PM2] RPC socket closed
[PM2] PUB socket closed
[PM2] exiting PM2
[PM2] [[[[ PM2/God daemon launched ]]]]
[PM2] RPC interface [READY] on port 6666
[PM2] BUS system [READY] on port 6667
[PM2] Starting execution sequence in -fork mode- for app name:app id:0
[PM2] App name:app id:0 online
[PM2] App name:app id:0 exited
[PM2] Process with pid 5001 killed
[PM2] PM2 is being killed via kill method
[PM2] killing PM2 via Satan
[PM2] RPC socket closed
[PM2] PUB socket closed
[PM2] exiting PM2
[PM2] [[[[ PM2/God daemon launched ]]]]
[PM2] RPC interface [READY] on port 6666
[PM2] BUS system [READY] on port 6667
[PM2] Starting execution sequence in -fork mode- for app name:test id:0
[PM2] App name:test id:0 online
[PM2] App name:test id:0 exited
[PM2] Process with pid 9201 killed
[PM2] PM2 is being killed via kill method
[PM2] killing PM2 via Satan
[PM2] RPC socket closed
[PM2] PUB socket closed
[PM2] exiting PM2
[PM2] [[[[ PM2/God daemon launched ]]]]
[PM2] RPC interface [READY] on port 6666
[PM2] BUS system [READY] on port 6667
[PM2] Starting execution sequence in -fork mode- for app name:test id:0
[PM2] App name:test id:0 online
[test-0 (out)] starting
# cat test.js
var ipm2 = require('pm2-interface')();
console.log('starting');
ipm2.on('ready', function() { console.log('started'); });
Maybe I've done something wrong but I can't get the close or disconnect event from axon
https://github.com/Unitech/pm2-interface/blob/master/lib/index.js#L88
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.