Wednesday, September 1, 2010

Install VNstat on nagios

cd /usr/local/src
wget http://humdi.net/vnstat/vnstat-1.10.tar.gz
tar -zxvf vnstat-1.10.tar.gz
cd vnstat-*
make
make install


Create Database

To monitor eth1

/usr/bin/vnstat -u -i eth1

For eth0

/usr/bin/vnstat -u -i eth0

Set init Script


cp examples/init.d/redhat/vnstat /etc/init.d
chkconfig --add vnstat
chkconfig vnstat on
service vnstat start

After installation, it take some time to generate bandwidth usage stats. So you need to wait few hours before you can check the stats. During the time, vnstat cronjob runs and collect data from your server to generate the report.

To see the bandwidth usage stat

vnstat
vnstat -d
vnstat -m
Here is an sample vnstat report
[root@server18 vnstat-1.5]# vnstat
Database updated: Thu Jan 10 10:52:36 2008

eth1

received: 5.24 MB (3.3%)
transmitted: 147.44 MB (96.7%)
total: 152.68 MB

rx | tx | total
-----------------------+------------+-----------
today 5.24 MB | 147.44 MB | 152.68 MB
-----------------------+------------+-----------
estimated 11 MB | 324 MB | 335 MB
[root@server18 vnstat-1.5]#

1 comment: