pm2
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -61,2 +61,2 @@ | ||
} | ||
}; | ||
}; |
@@ -88,2 +88,3 @@ // pm2-monitor // Code name : God | ||
usage.lookup(pro.pid, { keepHistory : true }, function(err, res) { | ||
@@ -94,2 +95,3 @@ pro['monit'] = res; | ||
}); | ||
return false; | ||
}; | ||
@@ -96,0 +98,0 @@ |
@@ -8,4 +8,11 @@ | ||
const RATIO = 300000000; | ||
Monit.init = function(processes) { | ||
if (processes === undefined) throw new Error('No processes passed to init'); | ||
if (processes === undefined || processes[0] == null) | ||
throw new Error('No processes passed to init'); | ||
if (processes[0].monit == null || processes[0].monit == undefined) | ||
throw new Error('You seems to run on a Mac OS, node-usage can\'t get monitor data'); | ||
Monit.multi = multimeter(process); | ||
@@ -16,3 +23,3 @@ | ||
Monit.multi.write('PM2 monitoring :\n\n'); | ||
Monit.multi.write('\x1B[32m⌬ PM2 \x1B[39mmonitoring :\n\n'); | ||
@@ -50,3 +57,3 @@ processes.forEach(function(proc, i) { | ||
bar_memory.ratio(proc.monit.memory, | ||
400000000, | ||
RATIO, | ||
bytesToSize(proc.monit.memory, 3)); | ||
@@ -58,19 +65,15 @@ bars[proc.pid] = {}; | ||
}); | ||
} | ||
}; | ||
Monit.refresh = function(dt) { | ||
if (Object.keys(bars).length == 0) { | ||
Monit.multi.write('No online process to monitor\n'); | ||
process.exit(1); | ||
} | ||
dt.forEach(function(proc, i) { | ||
if (proc && proc.monit && bars[proc.pid]) { | ||
bars[proc.pid].cpu.percent(proc.monit.cpu); | ||
bars[proc.pid].memory.ratio(proc.monit.memory, | ||
200000000, | ||
RATIO, | ||
bytesToSize(proc.monit.memory, 3)); | ||
} | ||
}); | ||
} | ||
}; | ||
@@ -77,0 +80,0 @@ function bytesToSize(bytes, precision) { |
{ | ||
"name": "pm2", | ||
"preferGlobal": "true", | ||
"version": "0.4.0", | ||
"os" : [ "!win32" ], | ||
"version": "0.4.1", | ||
"engines" : { | ||
@@ -10,3 +9,3 @@ "node" : ">=0.8" | ||
"homepage" : "http://unitech.io/", | ||
"description": "The next generation process manager for Node.js. Clusterize app with 0 lines of code more.", | ||
"description": "The next generation process manager for Node.js with native clusterization", | ||
"main": "index.js", | ||
@@ -22,2 +21,3 @@ "scripts": { | ||
"tools", | ||
"pm2", | ||
"monitoring", | ||
@@ -51,3 +51,3 @@ "process manager", | ||
"type" : "git", | ||
"url" : "git://github.com/unitech/pm2.git" | ||
"url" : "git://github.com/Unitech/pm2.git" | ||
}, | ||
@@ -54,0 +54,0 @@ "author": { |
@@ -5,7 +5,6 @@ ![Monit](https://github.com/unitech/pm2/raw/master/pres/pm2.png) | ||
[![Build Status](https://david-dm.org/Unitech/pm2.png)](https://david-dm.org/Unitech/pm2) | ||
[![NPM version](https://badge.fury.io/js/pm2.png)](http://badge.fury.io/js/pm2) | ||
The next generation process manager for Node.js. | ||
The next generation daemon process manager for Node.js with native clusterization. | ||
Automatic clusterisation, upstart scripts, keep alive process, process monitoring, logs aggregation. | ||
# Installation | ||
@@ -17,9 +16,9 @@ | ||
# Quick start | ||
# Usage/Features | ||
``` | ||
$ npm install pm2 -g // Install pm2 command line globally | ||
$ pm2 start app.js -i 4 // Start 4 clustered instances of app.js | ||
$ pm2 start app.js -i 4 // Daemonize pm2 and Start 4 clustered instances of app.js | ||
$ pm2 list // Display the status of the processes | ||
$ pm2 list // Display all processes status | ||
$ pm2 monit // Monitor all processes | ||
@@ -26,0 +25,0 @@ $ pm2 logs // Display all processes logs in streaming |
Sorry, the diff of this file is not supported yet
412695
991
147