ninuxorg / nodeshot

Django based tools to create crowdsourcing web apps.
http://docs.nodeshot.org/
Other
324 stars 113 forks source link

Implement bandwidth usage monitoring #94

Open zioproto opened 12 years ago

zioproto commented 12 years ago

Hello,

instead of having an external tool like Cacti to monitor the network, it would be nice to integrate this feature in NodeShot, to have less monkey work to do when adding a new node, and have the graphs available more easily.

Here I have a proposal for how to implement this feature. Please comment what follows, because something might be wrong.

Part 1) Collecting the data:

Bandwidth usage data in stored in RRD files.

1 RRD file is the data to describe the graph of bandwidth usage of 1 interface.

So 1 of the key point is what filename to give to RRD files, so that we can relate 1 RRD file to 1 interface in the nodeshot database. Please note that I would avoid using the IP address as a logical connector from the Interface to the RRD file, because the address could change, or there could be no IPv4 address. So, I need a suggestion here from who is very familiar with the nodeshot database model.

Nodeshot already have cronjobs. For example we use cronjobs to draw the current network topology.

We need a CronJob every 5 minutes where we run something similiar to this script:

https://github.com/zioproto/ninuxstats/blob/testing/main.sh

Now, for each /32 route entry in the table, starting from the IP address we should identify the interfaces in the database of nodeshot, and probe data to update the RRD file.

Part 2) Rendering the data:

When we click on 1 link now we have a small baloon that display ETX and dBM. The baloon should be bigger or have a second tab, and we shuold display here 2 graphs. Because the link is from interface A to interface B we should display always two graphs. The two graphs will be identical but with IN/OUT inverted in case of point to point link. Where we have a AP with several STA the two graphs will be more interesting, because on the STA side we see just the graph of the link, and on the AP side we see the aggregate interfering graph of the AP interface.

Once we have a RRD file with a name that identifies a single interface in the DB it would not be hard to render the graph.

Please look at this: https://github.com/zioproto/ninuxstats/blob/testing/genera.php https://github.com/zioproto/ninuxstats/blob/testing/genera.sh

G10h4ck commented 12 years ago

It seems a good idea, but i think we should to use just one connection to the node to gather all data we have already a script to take dbm on openwrt nodes via ssh, adding bandwidth stuff should be easy

zioproto commented 12 years ago

Please share the script :) Put here the link to your git repository :)

G10h4ck commented 12 years ago

http://gitorious.org/eigennet/packages/blobs/master/eigennet/src/links.sh

nemesifier commented 12 years ago

@OrazioPirataDelloSpazio last year did something with RDD, but I commented out all the view because I couldn't make it with the time I had, then I forgot about it. Now that you brought it up again It came into my mind.

Checkout this file: https://github.com/ninuxorg/nodeshot/blob/master/nodeshot/views.py Look for "generate_rrd".

Maybe @OrazioPirataDelloSpazio might be able to tell us what he was trying to do.

lorenzobracciale commented 12 years ago

Boyz, the rrd script are pretty easy and almost already done. (Nino is collecting stats since one year and already got scripts to create png from RRD).

One year ago I tried this js library:

http://javascriptrrd.sourceforge.net/

but maybe the classical png could be the the easier and most robust solution.

Not too much to code imho. Where do you suggest to put the graphs?

ninnux commented 11 years ago

I wrote a new version of ninuxstats (branch solole10) https://github.com/ninnux/ninuxstats that collect statistics for all node interfaces. You can try new and old implementation here: 176.62.53.7/genera.php?ip=<172.x.x.x> or 176.62.53.7/genera2.php?ip=<10.x.x.x>_. Two example uri are: http://176.62.53.7/genera.php?ip=172.16.200.67 or http://176.62.53.7/genera2.php?ip=10.162.0.225_ath0. We have to make an extra effort on nodshot information system integration or olsr integration for better statistic full automation fetching process: AirOS does'nt support v2c snmp version, so mib are very poor. It's impossible to indentify different ip addresses of the same node using snmp information only. The are two dfferent ways to have this information: