vergoh / vnstat

vnStat - a network traffic monitor for Linux and BSD
GNU General Public License v2.0
1.45k stars 123 forks source link

No or very low results. #230

Closed Achaean closed 2 years ago

Achaean commented 2 years ago

I've compiled the latest stable version (2.9) locally at my system (PCLinux) and it sometimes displays unrealistic low results (only a few KBs) or it doesn't displays any results at all (zeros).

vergoh commented 2 years ago

Is this issue visible only with database related queries (vnstat -5, vnstat -d, vnstat -m etc.) or also with the live output modes (vnstat -l / vnstat -tr)?

Does vnstat --iflist show the correct Mbit value for the interface you are monitoring?

Achaean commented 2 years ago

THANKS Teemu for your reply!!! (and for all your work in general).

1) The Ethernet interface I'm using,, seems to be properly detected:

>vnstat --iflist
Available interfaces: eth0 (100 Mbit)
>

2) The live modes, also are lookig properly working:

>vnstat -l
Monitoring eth0...    (press CTRL-C to stop)

rx:         0 bit/s     0 p/s          tx:         0 bit/s     0 p/s^C

eth0  /  traffic statistics

rx         |       tx
--------------------------------------+------------------
bytes                   697,48 KiB  |      166,41 KiB
--------------------------------------+------------------
max          959,15 kbit/s  |   260,69 kbit/s
average          190,46 kbit/s  |    45,44 kbit/s
min                0 bit/s  |         0 bit/s
--------------------------------------+------------------
packets                        762  |             596
--------------------------------------+------------------
max                 98 p/s  |          78 p/s
average                 25 p/s  |          19 p/s
min                  0 p/s  |           0 p/s
--------------------------------------+------------------
time                    30 seconds
>

and:

>vnstat -tr
3566 packets sampled in 5 seconds
Traffic average for eth0

rx         5,46 Mbit/s           494 packets/s
tx       146,31 kbit/s           219 packets/s
>

and 3) Database query modes, seems to be the problematic ones:

>vnstat -5

eth0  /  5 minute

time        rx      |     tx      |    total    |   avg. rate
------------------------+-------------+-------------+---------------
2022-05-27
23:15      4,74 KiB |   20,51 KiB |   25,25 KiB |      689 bit/s
2022-05-29
02:50      4,04 KiB |   18,67 KiB |   22,71 KiB |      620 bit/s
------------------------+-------------+-------------+---------------
>
>vnstat -d

eth0  /  daily

day        rx      |     tx      |    total    |   avg. rate
------------------------+-------------+-------------+---------------
2022-05-23    71,18 MiB |    2,71 MiB |   73,89 MiB |    7,17 kbit/s
2022-05-24     4,04 MiB |  161,15 KiB |    4,20 MiB |      407 bit/s
2022-05-25     6,59 KiB |   32,15 KiB |   38,74 KiB |        3 bit/s
2022-05-26     3,74 KiB |   17,35 KiB |   21,09 KiB |        1 bit/s
2022-05-27     4,74 KiB |   20,51 KiB |   25,25 KiB |        2 bit/s
2022-05-29     4,04 KiB |   18,67 KiB |   22,71 KiB |        3 bit/s
------------------------+-------------+-------------+---------------
estimated       --      |     --      |     --      |
>

At the last one, you can see, that the last meaningful entry, is from 23/5. The other ones, are very low. Also the 28/9 is zeroed.

PS. I don't have the earlier days data (from 22/5 and earlier), because I had the repository version, which I purged and compiled the latest one (in a try to identify and troubleshoot this problem).

vergoh commented 2 years ago

Check what the daemon's log shows. Since the live output modes show correctly then there's something causing the daemon to ignore traffic, most likely to some sort of configuration issue. The log should provide some idea which condition is causing that to happen. You'd also want to verify that the daemon indeed stays running.

Achaean commented 2 years ago

I already checked that daemon's running. Let me check the logs and I'll be back.

Achaean commented 2 years ago

Check what the daemon's log shows.

I tried so far, the logfile (1) option.

Nope! It fails. At /var/log/, there's no vnstat directory.

I'll try the syslog option too.

vergoh commented 2 years ago

The location of the logs will depend on the parameters you are using to start the daemon. If the -n or --nodaemon parameter is given then the daemon will output to standard output and it's up to the used service manager to store the log in a suitable place. As PCLinux doesn't apparently use systemd, it will depend on the service configuration you've done where the log output is currently going.