How to get peak Bandwith for last 5 minutes or so?

I'm trying to get the peak bandwidth for the last X (eg 5) minutes. Something similar to the the realtime graphs on luci Realtime Graphs. I've installed vnstat, which is interesting but doesn't seem to server this purpose.

Looking at the code in git, I see it calls luci-bwc and I call luci-bwc -i eth0.2 I get a bunch of data. I could look through the code and try and reverse engineer what the page is doing to show that. I tried finding information on luci-bwc but did not have much luck, so I thought I'd ask here. Maybe there is a command that I'm missing that does this or another way to achieve what I'm trying?

Thanks.

first of all lets clarify your question a little... you said 'get peak bandwidth'... that's pretty ambiguous... can we assume you mean;

  • determine utilised (bi-directional) bandwidth (peak-avg) on a single primary wan interface?

secondly... as you've mentioned... timing comes into play on this as does whether or not you want to exclude certain overheads / peak-avgVSmean-avg / etc. etc. etc.

that said... the most portable / raw mechanism is proc/net then as you mention we step up to more 'aware' tools either binary or scripts with statefullness...

fwiw... I also need something similar right now for my lcddisplay rotation ( bidirectional 'current'{aka~30secavgpeak} )... so watching with interest...