vnstat on OpenBSD self compiled

To compile vnstat for my OpenBSD i did following simple steps:

Define the server were pkg_add gets it packages from. As the line indicates it is for OpenBSD 4.5.

export PKG_PATH=

Install the wget package to be able to download the vnstat sources.

pkg_add wget

Retrieve the source tar ball.


Unpack the tar ball verbosely.

tar xvfz vnstat-1.10.tar.gz

Now change to the extracted directory.

cd vnstat-1.10

Install package gmake to be able to compile the stuff.

pkg_add gmake

Compile the sources - binary is created in subdirectory "src".

gmake -C src vnstat

Copy the generated binary to a place found in $PATH.

cp src/vnstat /usr/bin/.

Create the directory for vnstats collected data

mkdir /var/db/vnstat

Initialize the interface vnstat has to collect for

vnstat -u -i

And add a line to your crontab:

*/5 * * * * /usr/bin/vnstat -u

Don't forget restart/SIGHUP the cron daemon.

Wait a few minutes to give vnstat the chance to collect data and try

vnstat -i -h

That's all - did it work for you? Just drop your comments here.


Anonymous said…
Doesn't work...
[12:55:45][root@mir:~/vnstat-1.10]# gmake -C src vnstat
gmake: Entering directory `/root/vnstat-1.10/src'
gcc -O2 -c -o vnstat.o vnstat.c
In file included from vnstat.c:18:
common.h:21:25: sys/statvfs.h: No such file or directory
gmake: *** [vnstat.o] Error 1
gmake: Leaving directory `/root/vnstat-1.10/src'

[12:55:57][root@mir:~/vnstat-1.10]# uname -a
OpenBSD 4.3 GENERIC#698 i386
Anonymous said…
Works great (April 2015)

Popular Posts