4 linux network traffic web monitoring
6 This little program will allow you to create embedable live monitoring charts on any web page.
8 Example server with 6 interfaces:
9 ![image](https://f.cloud.github.com/assets/2662304/664777/3dad6c32-d78d-11e2-9ecf-b921afebfb0b.png)
11 Example server with 20 interfaces:
12 ![image](https://f.cloud.github.com/assets/2662304/689979/807dfb4e-dac6-11e2-8546-6d83fdb05866.png)
17 1. You run a daemon on your linux: netdata.
18 This deamon is written in C and is extremely lightweight.
22 - reads /proc/net/dev and for every interface present there it keeps in its memory a short history of its received and sent bytes.
23 - generates JSON HTTP responses containing all the data needed for the web graphs.
24 - is a web server. You can access JSON data by using:
27 http://127.0.0.1:19999/data/net.eth0
30 This will give you the JSON file for traffic on eth0.
31 The above is equivalent to:
34 http://127.0.0.1:19999/data/net.eth0/3600/1/average
39 - 3600 is the number of entries to generate (3600 is a default which can be overwritten by -l).
40 - 1 is grouping count, 1 = every single entry, 2 = half the entries, 3 = one every 3 entries, etc
41 - `average` is the grouping method. It can also be `max`.
44 2. On your web page, you add a few javascript lines and a DIV for every graph you need.
45 Your browser will hit the web server to fetch the JSON data and refresh the graphs.
47 3. Graphs are generated using Google Charts API.
53 ## Automatic installation
55 1. Download everything in a directory inside your web server.
56 2. cd to that directory
63 For this to work, you need to have persmission to create a directory in /run or /var/run or /tmp.
64 If you run into problems, try to become root to verify it works. Please, do not run netdata are root permanently.
65 Since netdata is a web server, the right thing to do, is to have a special user for it.
67 Once you run it, the file netdata.conf will be created. You can edit this file to set options for each graph.
68 To apply the changes you made, you have to run netdata.start again.
70 To access the panel for all graphs, go to:
73 http://127.0.0.1:19999/
80 ## Installation by hand
83 step into the directory you downloaded everything and compile netdata
86 gcc -Wall -O3 -o netdata netdata.c -lpthread
93 ./netdata -d -l 60 -u 1 -p 19999
95 - -d says to go daemon mode
96 - -l 60 says to keep 60 history entries
97 - -u 1 says to add a new history entry every second
98 - -p 19999 is the port to listen for web clients
101 Set in index.html the interfaces you would like to monitor on the web page.
103 ** REMEMBER: there are 2 sections in index.html to edit. A javascript section and an HTML section. **
105 ### open a web browser
108 http://127.0.0.1:19999/