View Full Version : MRTG Total Bandwidth [Newbie Question]
interactive
05-04-03, 06:03 PM
Yes, yes I'm a newbie. I'm not sure what the deal is but when I look at other people's MRTG graphs it shows total throughput. When I installed and setup MRTG on my server it monitors traffic. What do I have to do to get the "Throughput" pageds? Thanks
By throughput do you mean actual usage (as in gigs/month)? If so, the easiest way to measure that in Linux is using iptables.
interactive
05-04-03, 06:52 PM
Ya I mean total throughput. How would I do it using iptables? I would like to *also* measure 95th. Thanks
Do:
iptables -I INPUT ! -i lo; iptables -I OUTPUT ! -o lo
Then setup a cronjob that runs once a month when your host checks your bandwidth that does:
iptables -R INPUT 1 ! -i lo; iptables -R OUTPUT 1 ! -o lo
to reset it. You could do iptables -Z INPUT instead, but if you ever add any more rules to INPUT it would reset their counters too.
Next setup a cron job that runs regularly (I have it run every hour) that does:
iptables-save -c > /etc/iptables
That saves every table, all the chains in those tables, and all of the rules in those chains with their counters to the file /etc/iptables (feel free to pick a different name, that's just what I use).
After that put:
iptables-restore -c < /etc/iptables
in your rc.local. This restores those rules and their counters on boot.
Now just do iptables -L -v to see your current bandwidth usage. Look at those rules' counters, not the chains' counters.
Read up on iptables sometime, it can be very useful to know how to use your OS's packet filter. If you know the basics of TCP/IP the man pages should be good enough. If not, well, if not keep reading if you really want to start an ISP :)
vBulletin v3.5.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.