netstat.js
A simple js wrapper for the netstat daemon.
Allows you to output network statistics in real-time through stdout or via a socketio server.
Output is available in json or as raw stdout lines.
Installing
$ npm install netstat --save
Note: you will need node
and npm
installed first.
The easiest way to install node.js
is with nave.sh by executing [sudo] ./nave.sh usemain 0.10
You will need netstat
installed, this is not a replacement for netstat
; just a wrapper. On most unix-like systems it should be provided by default by the net-tools
package.
Getting data from netstat
var netstat = ; netstat; netstat;
Example output:
[ , ]
Binary version
You can install netstatjs
globally by executing [sudo] npm install -g netstat
If you installed locally then you can execute it like this ./node_modules/netstatjs/bin/netstatjs --help
The binary version has a few nice features like daemonizing & sending json stats to stdout or via socketio.
peter@edgy:/var/www$ netstatjs --help Usage: netstatjs [options] Options: -h, --help output usage information -V, --version output the version number -s, --socketio [port] bind socketio to port and stream stats in json -j, --json [indent] pipe json stats to stdout/stderr -r, --raw pipe raw stats to stdout/stderr
Examples
More examples can be found in /bin/command/*
.
Status
This module is usable but not yet feature rich, netstat provides heaps more cool features that are not yet supported. Please star, fork and pull request if you find this useful.
License
Released under the Software license This work 'as-is' we provideNo warranty express or impliedTherefore no claim on us will abideLiability for damages denied Permission is granted herebyto copy share and modifyUse as is fitfree or for profitThese rights on this notice rely