After installing vnstat to keep an eye on server IN and OUT traffic on a Debian Squeeze server. I used the usual:
debian:~# vnstat -u -i eth0
In order to generate the initial database for the ethernet interface used by vnstat to generate its statistics.
However even though /var/lib/vnstat/eth0 got generated with above command statistics were not further generated and trying to check them with command:
debian:~# vnstat --days
Returned the error message:
eth0: Not enough data available yet.
To solve the eth0: Not enough data available yet. message I tried completely removing vnstat package by purging the package e.g.:
debian:~# apt-get --yes remove vnstat
...
debian:~# dpkg --purge vnstat
...
Even though dpkg –purge was invoked /var/lib/vnstat/ refused to be removed since it contained vnstat’s db file eth0
Therefore I deleted by hand before installing again vnstat:
debian:~# rm -rf /var/lib/vnstat/
Tried installing once again vnstat “from scratch”:
debian:~# apt-get install vnstat
...
After that I tried regenerating the vnstat db file eth0 once again with vnstat -u -i eth0 , hoping this should fix the error but it was no go and after that the error:
debian:~# vnstat --hours
eth0: Not enough data available yet.
persisted.
I checked in Debian bugs mailing lists and I found, some people complaining about the same issue with some suggsetions on how the error can be work arouned, anyways none of the suggestions worked for me.
Being irritated I further removed / purged once again vnstat and decided to give it a try by installing vnstat from source
As of time of writting this article, the latest stable vnstat version is 1.11 .
Therefore to install vnstat from source I issued:
debian:~# cd /usr/local/src
debian:/usr/local/src# wget http://humdi.net/vnstat/vnstat-1.11.tar.gz
...
debian:/usr/local/src# tar -zxvvf vnstat-1.11.tar.gz
debian:/usr/local/src# cd vnstat-1.11
debian:/usr/local/src/vnstat-1.11# make & make all & make install
debian:/usr/local/src/vnstat-1.11# cp examples/vnstat.cron /etc/cron.d/vnstat
debian:/usr/local/src/vnstat-1.11# vnstat -u -i eth0
Error: Unable to read database "/var/lib/vnstat/eth0".
Info: -> A new database has been created.
As a last step I put on root crontab to execute:
debian:~# crontab -u root -e
*/5 * * * * /usr/bin/vnstat -u >/dev/null 2>&1
This line updated vnstat db eth0 database, every 5 minutes. After the manual source install vnstat works, just fine 😉
More helpful Articles
Tags: amp, bin, bugs, cron, debian gnu, dpkg, error message, eth, ethernet interface, eye, file, GNU, gnu linux, hourseth, initial database, installdebian, lib, Linux, none, package, quot, Returned, rf, root, scratch, squeeze, statistics, tar, tar gz, time, traffic, vnstatdebian, wget, work, zxvvf
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0
Thanks for this new tip !
I think instead of
apt-get –yes remove vnstat
You should have done
aptitude purge vnstat
View CommentView CommentMozilla/5.0 (X11; U; Linux x86_64; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Version/5.0 Safari/531.2+ Debian/squeeze (2.30.6-1) Epiphany/2.30.6
Sure but I’m not very in love with aptitude. That’s why I do it the old fashioned way.
View CommentView CommentMozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1
on squeeze work for me service vnstat restart, then works all fine
View CommentView CommentMozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4
ok,, I ran into a problem being that the vnstat -l would work fine
but everything else would show not enough data yet,
For Centos edit this two files
vi /etc/init.d/vnstat
(near top / note your system usr folder if it is “bin” or “sbin”)
VNSTATD_BIN=/usr/bin/vnstatd
then
vi /etc/cron.d/vnstat
*/5 * * * * vnstat /usr/bin/vnstat.cron
(just like the first time check on your system if it is “bin” or “sbin”)
editing these two files will make your vnstat generate data right away
View CommentView CommentMozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
Thanks Andy! 🙂
View CommentView CommentMozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36
Had kinda the same problem using ver 1.18 and Centos .. "vnstat -u -i eth0" did the trick
Thnx!
View CommentView Comment