Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Connection Monitoring with Nodejs

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

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.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Connection Monitoring with Nodejs

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×