10 August 2010 1 Comment

Monitoring Proxmox OpenVZ container’s bandwidth

Use these scripts to collect bandwidth data for each container. You can view the data on a graph and total usage by months.

The scripts are originally received from Hutzoft but modified to work with the Proxmox directory structure.

1. Install rrdtool and PHP support

apt-get install rrdtool php5

2. Download the bandwidth collection script and Web UI

wget http://www.aip.im/downloads/vzmonitor.tar.gz

3. Unpack and relocate

tar zxvf vzmonitor.tar.gz
mkdir /usr/local/bandwidth
mv bandwidth /usr/local/bandwidth/
mv vzmonitor /var/www/

4. Create a cron job to collect the data every 5 minutes (crontab -e)

*/5 * * * * cd /usr/local/bandwidth;./bandwidth.sh &> /dev/null

5. Add config to Apache (pico /etc/apache2/conf.d/vzmonitor.conf)

Alias /vzmonitor /var/www/vzmonitor
 
<Directory /var/www/vzmonitor>
DirectoryIndex index.php
</Directory>

6. Restart Apache

/etc/init.d/apache2 restart

7. It's ready, wait a few minutes and enter this location to view the bandwidth usage: http://yourserver/vzmonitor

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • email
  • LinkedIn
  • Live
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz
Tags: ,

One Response to “Monitoring Proxmox OpenVZ container’s bandwidth”

  1. Alienation 29 October 2010 at 5:09 pm #

    Thanks, worked like a charm. Just a note:

    in step 3 there’s a typo:

    mv bandwidth /usr/local/bandwidth/

    should be:

    mv bandwidth.sh /usr/local/bandwidth/

    Also, there’s really no need for step 5. Just get the php script where apache can access it.

    Anyway, really useful. Thanks again


Leave a Reply