|Bandwidth Accounting + Graphing and More for OpenVZ [message #1341]
||Mon, 06 February 2006 21:56
Registered: January 2006
Well, I found the iptables method of collecting bandwidth a bit too hands on and unforgiving. Therefore, using my mad php skills, and some bash scripting, I've whipped up an set of applications that allows you a more graphical and accurate overview using rrdtool, and some PHP scripts. You can have full bandwidth accounting for your VPS including daily, monthly and weekly tabulated data in about 5 minutes of setup time.|
Here's some screen shots (full size screens are on our site):
The total process takes about 5 minutes to setup using the pre-created CentOS 4.2 templates that I have packaged up for you, and installing a bash script that does the collection.
The cool thing is, when you add a new VPS, the cronjob will automatically detect this and add the graphs for you. In addition, when you delete a VPS, the graphs and .rrd files will be deleted with it.
The only thing you need to install on the hostnode is the bash script and the rrdtool rpm ( or compile rrdtool from source ). The rest of the display, and web server that displays these graphs is located inside the VE that you'll create specifically for this purpose.
I just wanted to give something back to the community. Thanks for all that you are doing to help this awesome solution grow and become even more evolved
The full details are found at ServerPowered.com, our server website: http://www.serverpowered.com/openvz-bandwidth-accounting.php
Please direct any discussions here, and not on our server company's website I'll subscribe to this and help you out if you need it.
[Updated on: Mon, 06 February 2006 22:14]
Report message to a moderator
|Re: Bandwidth Accounting + Graphing and More for OpenVZ [message #37737 is a reply to message #1341]
||Thu, 15 October 2009 05:33
Registered: October 2008
I just update this excellent script for Debian Lenny x64 on both (HN and CT) and with the 1.3.1 version of rrdtool, I also did some minor changes in the script.
Here is a little HOWTO implement it :
1. You must have installed Debian Lenny x64 + OpenVZ + rrdtool on your HN.
2. Download and create a container using this template:
mv Debian-Lenny-x64_bandwidth.tar.gz /vz/template/cache/
vzctl create 101 --ostemplate debian-5.0-x86_64 --config ve-vps.basic --hostname graphs.yourdomain.com --ipadd xxx.xxx.xxx.xxx --name graphs
vzctl set 101 --onboot yes --nameserver xxx.xxx.xxx.xxx --userpasswd root:xxxxxxx --save
vzctl start 101
You can errase my old rrd data:
vzctl exec 101 rm /home/bandwidth/*
3. Download the script (Bash) to collecting data:
You can open it and change the container number in the BWVE variable.
4. You can make an crontab to run this script every 5 min:
*/5 * * * * root /root/bandwidth.sh 1>/var/log/vz-bandwidth.log 2>&1
5. Wait 5 min then visit: http://xxx.xxx.xxx.xxx/ and happy graphing !
I hope it's useful!
----------- Daniel Vazart ------------
"Knowledge is power, Sharing is human"
------- http://www.vazart.net --------