Connection Monitoring with Nodejs
Problem
I would like to monitor the active connections connected to my node.js server. I've seen NodeFly can do this, but I would like to have a tool locally installed on my server (ubuntu).
Is there any (maybe free) software/app to achieve this?
Thanks.
Problem courtesy of: Christian
Related Articles
Solution
I don't know of anything doing that out of the box, but assuming you have an express app, you could start with:
var exec = require('child_process').exec; ... app.get('/status', function (req, res) { exec('lsof +p `pgrep node` | grep TCP', function (err, stdout, stderr) { req.send(stdout); }); });
Solution courtesy of: Laurent Perrin
Discussion
View additional discussion.