in Linux, OpenVZ, Proxmox

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

Write a Comment

Comment

  1. 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

  2. Hello
    I can’t make the script working fine , I have the output “bandwith can’t cd…
    and o /usr/local/bandwidth
    /bin/sh: 1:
    in the http://wbserver/vzmonitor i have only “all” and “View” but not listing the containers
    can you please help me ?
    sami

  3. This no longer works because proxmox doesnt use apache any more. Uses its own web server

  4. you could just install apache as well and use that just for the monitoring and let proxmox do it’s own thing