A Node.js powered HTTP network monitor
HTTP Network Monitor runs on Node.js. Make sure you have both Node.js and NPM installed.
- The developers of this project use a Raspberry Pi as the network monitor. Here are Pi-specific instructions on installing Node.js and NPM.
- Install libraries:
- Update package lists:
sudo apt-get update
- Install libpcap:
sudo apt-get install libpcap-dev
- Install g++:
sudo apt-get install g++
- Update package lists:
- Clone repository:
git clone https://github.com/gregnr/http-network-monitor.git
- Navigate into directory:
cd http-network-monitor
- Initialize node-http-parser submodule:
git submodule update --init
- Install dependencies from package.json file:
npm install
- The dashboard website uses Bower for dependencies
- Install bower globally:
sudo npm install -g bower
- Navigate to website directory:
cd static
- Install dependencies from bower.json file:
bower install
- Install bower globally:
- Install postgres:
sudo apt-get install postgresql postgresql-contrib
- Login as root user for postgres:
sudo -i -u postgres
- Create the "monitor" postgres user:
createuser -P -s -e monitor
, you will be prompted for a password - Create a new postgres db:
createdb monitor
- Open postgres:
psql
- Create a password for the postgres user:
\password postgres
(Allows for local connections to psql) - Quit postgres:
\q
- Return to regular user:
exit
- Allow local connections by editing the config file:
sudo vim /etc/postgresql/9.3/main/pg_hba.conf
- Change line
local all postgres peer
tolocal all postgres md5
- Save and exit vim
- Restart postgres:
sudo service postgresql restart
- Add the MessageExchange table and grant permissions to "monitor" user (using the SQL schema file):
psql -d monitor -U postgres -W -a -f database_schema.sql
Since we will be reading network packets from the kernel, you need root access to run the monitor.
- Run the monitor:
sudo node monitor.js
(captures packets) - Run the web server:
sudo node server.js
(serves admin dashboard) - Go to http://localhost/ in your browser to visit the admin dashboard
- Pull new changes:
git pull
- Update node-http-parser submodule to correct commit:
git submodule update
- Install any new dependencies from package.json file:
npm install
Some people may want to test this app on a virtual machine. Use these instructions to set up an Ubuntu image on Virtualbox.
- Download Virtualbox
- Download an Ubuntu ISO
- To use in 64-bit, you may need to enable Intel Virtualization and Intel VT-d in your BIOS
- Create a new VM in Virtualbox (~2GB memory, ~8GB dynamically allocated storage)
- Window resize and copy-paste functionality requires requires the guest additions. Go to "Devices > Insert guest additions CD image" in the virtualbox window to install this package. Then restart the VM.