Vnstat: Difference between revisions

From Leo's Notes
This page was last edited on 23 March 2015, at 17:00.
No edit summary
No edit summary
Line 14: Line 14:
/etc/init.d/vnstat start
/etc/init.d/vnstat start
</syntaxhighlight>
</syntaxhighlight>
== Usage ==
You do not need to interface with vnstat directly since vnstat will create a cronjob in <code>/etc/cron.d/vnstat</code> which will run <code>/usr/sbin/vnstat.cron</code> as nobody every 5 minutes.
However, you may need to fix or initialize the database.
=== Initializing Database ===
To initialize a database for a specific device:
vnstat -u -i $NetInterface
=== Force Update ===
sudo -u /usr/sbin/vnstat.cron --force




[[Category:Guides]]
[[Category:Guides]]
[[Category:Linux]]
[[Category:Linux]]

Revision as of 17:00, 23 March 2015

Installation

The following steps should work for CentOS/ScientificLinux/RHEL.

wget http://humdi.net/vnstat/vnstat-1.11.tar.gz
tar -xzf vnstat-1.11.tar.gz
cd vnstat-1.11
make
make install
vnstat --testkernel
/bin/cp examples/init.d/centos/vnstat /etc/init.d/vnstat
chkconfig --levels 234 --add vnstat
vnstat -u -i eth0
/etc/init.d/vnstat start

Usage

You do not need to interface with vnstat directly since vnstat will create a cronjob in /etc/cron.d/vnstat which will run /usr/sbin/vnstat.cron as nobody every 5 minutes.

However, you may need to fix or initialize the database.

Initializing Database

To initialize a database for a specific device:

vnstat -u -i $NetInterface

Force Update

sudo -u /usr/sbin/vnstat.cron --force