vnstat 모니터링 (웹페이지용)

리눅스/Network|2015. 1. 26. 17:50
반응형

by Tweak on September 5, 2009 
in LinuxServers

vnStat is a network traffic monitor for Linux that keeps a log of daily network traffic for the selected interface(s). vnStat isn’t a packet sniffer. The traffic information is analyzed from the /proc -filesystem, so vnStat can be used without root permissions. However at least a 2.2.x kernel is required.

  1. Install vnStat
    wget http://humdi.net/vnstat/vnstat-1.7.tar.gz
    tar zxvf vnstat-1.7.tar.gz
    cd vnstat-1.7
    make
    make install

  2. Create databases for NICs
    vnstat -u -i eth0
    vnstat -u -i eth1

  3. Set a cronjob to check bandwidth usage
    Add a crontab job entry for vnStat.
    crontab -e
    and add the following line
    */5 * * * * /bin/vnstat -u

  4. Install the frontend
    cd /var/www/  <- DocumentRoot 디렉토리
    wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.4.1.tar.gz
    tar zxvf vnstat_php_frontend-1.4.1.tar.gz
    mv vnstat_php_frontend-1.4.1 vnstat

    Edit vnstat/config.php and adjust the following lines to your preference:
    $iface_list = array('eth0', 'eth1');
    $iface_title['eth0'] = 'Extern';
    $iface_title['eth1'] = 'Intern';
    $vnstat_bin = '/usr/bin/vnstat';

Finally we open our browser and type

http://yourdomain.tld/vnstat/

You should see something like this

vnstat

반응형

댓글()