vnstat not updating

If none of the more specific forums is the right place to ask

vnstat not updating

Postby morgon » 2018-10-04 23:33

Hi,

(again I think) I am having problems getting vnstat to work.

My box is connected via ethernet to my router (my interface is enp2s0).

I have installed vnstat via aptitude and changed the default interface in the config-file (/etc/vnstat.conf) to that interface (Interface "enp2s0").

Then I created the databases via some incantation I cannot remember but I have a enp2s0 and a .enp2s0 file in /var/lib/vnstat, both owned by vnstat:vnstat.

There is a process (owned by vnstat) that showes up as "/usr/sbin/vnstatd -n" in ps.

However the data reported never changes.

It only seems to get updated when I run "sudo vnstat -u" in a terminal, but I want vnstatd to update it automatically...

Can anybody help me get this to work (I remember vaguely that I have done battle with vnstat in the past)?

Many thanks!
morgon
 
Posts: 111
Joined: 2010-08-28 03:04

Re: vnstat not updating

Postby CwF » 2018-10-04 23:49

I've had that problem with extra ports, 2 and 3, when the first found port is disconnected. My note says delete and create the problem port, and maybe delete the first port if vnsat thinks there is one. Is there a enp1s0?
Code: Select all
vnstat -i enp2s0 --delete
vnstat --create -i enp2s0
CwF
 
Posts: 168
Joined: 2018-06-20 15:16

Re: vnstat not updating

Postby sunrat » 2018-10-05 22:47

I've had the same problem. That seems to have fixed it. :)
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 2495
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: vnstat not updating

Postby morgon » 2018-10-05 23:15

thanks for the reply.

No, there is no enp1s0, I really don't understand the new logic of naming interfaces...

And your recipe unfortunately did not work for me.

I tried and re-recreated the databases and restarted the service, after which vnstat reported "enp2s0: Not enough data available yet.".

So I watched an youtube-video after which vnstat still reported "Not enough data available yet".

So I ran "sudo vnstat -u", after which vnstat now reports ridiculous volumes (13.4 GB received today).

And the fundamental problem that even with a running vnstatd the statistics never seem to get updated remains.

I must say I am getting tired of this...

Is there any alternative to vnstat?
morgon
 
Posts: 111
Joined: 2010-08-28 03:04

Re: vnstat not updating

Postby CwF » 2018-10-06 00:21

If things are otherwise working, I'd first uninstall vnstat, reboot, reinstall, then take note of the response from vnstat with no switches and see what it says.
You could try to create the file /etc/network/interfaces.d/eth0.conf
Code: Select all
# eth0 = enp2s0
allow-hotplug enp2s0
iface enp2s0 inet dhcp

then reboot and see what vnsat alone says, then add/delete as before. I'd usually use a root terminal rather than sudo, not sure it matters.

The renaming can be changed, but I'd remind myself the system is otherwise working.
You could try /etc/udev/rules.d/70-persistent-net.rules where you can call out MAC's to name yourself, but that's not future proof and asking for trouble. Try to deal with the persistent naming as is. I've stopped renaming since errors there will stop a boot.
CwF
 
Posts: 168
Joined: 2018-06-20 15:16

Re: vnstat not updating

Postby sunrat » 2018-10-06 00:26

I had to run slightly different commands:

Code: Select all
# vnstat -i wlan0 --delete --force
# vnstat --create -i wlan0
$ systemctl restart vnstat.service


It probably won't do anything until you restart the service.
I renamed the wireless interface ages ago but that should be irrelevant to this issue, as long as you have the active interface specified.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 2495
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: vnstat not updating

Postby morgon » 2018-10-06 15:04

I did this:

Code: Select all
sudo systemctl stop vnstat.service
sudo vnstat -i enp2s0 --delete --force
sudo vnstat -i enp2s0 --create
sudo chown vnstat:vnstat /var/lib/vnstat
sudo chown vnstat:vnstat /var/lib/vnstat/enp2s0
sudo systemctl start vnstat.service


I have now a running /usr/sbin/vnstatd process, but the database never gets updated.

If I stop the service and run "sudo /usr/sbin/vnstatd -D -n" from a terminal it seems to work ok (the database gets updated) but it reports ridiculous usage numbers at first (14 GB received today).

What I have is a new internet-connection that is A LOT faster than anything I ever had (400 MBit/s) - could this be part of the problem (data arriving too fast for vnstat to handle it or overflowing some data-structure or whatever?)
morgon
 
Posts: 111
Joined: 2010-08-28 03:04

Re: vnstat not updating

Postby bw123 » 2018-10-06 16:19

What about totally purging and reinstalling, and let vnstat create the interfaces on first run?

from man vnstatd:
By default, if no databases are found, new databases
will be created during startup for all available interfaces excluding pseudo
interfaces lo, lo0 and sit0.
User avatar
bw123
 
Posts: 3580
Joined: 2011-05-09 06:02
Location: TN_USA

Re: vnstat not updating

Postby morgon » 2018-10-06 16:36

I tried.

sudo aptitude purge vnstat
sudo aptitude install vnstat


after that /var/lib/vnstat is empty.

vnstat reports "No database found. Nothing to do."

After "sudo systemctl restart vnstat.service" no vnstatd running.

I've come to hate vnstat.

UPDATE:

I've just noticed that after the purge and the re-install /etc/vnstat.conf contains the line "Interface eth0" - eth0 is an interface that does not even exist - is that a bug in the packag?
morgon
 
Posts: 111
Joined: 2010-08-28 03:04

Re: vnstat not updating

Postby bw123 » 2018-10-06 16:56

morgon wrote:I tried.

sudo aptitude purge vnstat
sudo aptitude install vnstat


after that /var/lib/vnstat is empty.
...


That is weird I get this:
Code: Select all
# apt purge vnstat
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libgd3 linux-image-4.9.0-7-amd64
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  vnstat* vnstati*
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 376 kB disk space will be freed.
Do you want to continue? [Y/n]     
(Reading database ... 139562 files and directories currently installed.)
Removing vnstati (1.15-2) ...
Removing vnstat (1.15-2) ...
Processing triggers for man-db (2.7.6.1-2) ...
(Reading database ... 139542 files and directories currently installed.)
Purging configuration files for vnstat (1.15-2) ...
dpkg: warning: while removing vnstat, directory '/var/lib/vnstat' not empty so not removed
Processing triggers for systemd (232-25+deb9u4) ...



and the database files are still present in /var/lib/vnstat

The man page for vnstat.conf says that the interface line is the default chosen when none is specified.
User avatar
bw123
 
Posts: 3580
Joined: 2011-05-09 06:02
Location: TN_USA

Re: vnstat not updating

Postby arzgi » 2018-10-06 17:03

Hardly a bug. Default value, which is quite common, can be changed.
arzgi
 
Posts: 389
Joined: 2008-02-21 17:03
Location: Finland

Re: vnstat not updating

Postby bw123 » 2018-10-06 17:10

I'm guessing this issue is on testing/sid or some other contraption?
User avatar
bw123
 
Posts: 3580
Joined: 2011-05-09 06:02
Location: TN_USA

Re: vnstat not updating

Postby CwF » 2018-10-06 17:13

morgon wrote:l /etc/vnstat.conf contains the line "Interface eth0" - eth0 is an interface that does not even exist - is that a bug in the packag?


This is what I poorly explain, see above.

I meant after reinstall, you see the eth0 as I expected, delete it at the command line and add the correct named port. Don't modify that file, or look at it. Ask and answer at the command line.
CwF
 
Posts: 168
Joined: 2018-06-20 15:16

Re: vnstat not updating

Postby morgon » 2018-10-06 17:41

I don't quite understand.

As mentioned above I did previously change the entry in the config-file to reflect the interface I want and could not get it to work.

What exactly do you mean by "Ask and answer on the command line"?

And what I mean is that eth0 does no longer exist by default - therefore it hardly makes a good default value...
morgon
 
Posts: 111
Joined: 2010-08-28 03:04

Re: vnstat not updating

Postby CwF » 2018-10-06 18:32

I mean don't concern yourself with the contents of file, permisions and the like...use vnstat at the command line start to finish.

After the reinstall, in a terminal "vnstat" with no switches or arguements to see if it gives any feedback on an empty eth0 database. This I can't remember and have nothing to test it on.

So, my note says delete eth0, perhaps a default that gets in the way, can't remember?

Then add the correct interface, and restart the service or reboot.

The concept is at default it will work with eth0 without configuration, ONLY eth0. From there regardless of the names you need to add them.

On the fresh install I would issue the delete command for eth0 regardless, if it fails no worry...
Next step install correct interface.

I skipped the pretty code boxes, they're already posted...

Others might have an opinion or recommendation on sudo, I'm pretty sure I would do all this in a root terminal.
CwF
 
Posts: 168
Joined: 2018-06-20 15:16

Next

Return to General Questions

Who is online

Users browsing this forum: No registered users and 8 guests

fashionable