LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   [Solved] vnstat -d,-w,-m all return "no data available" but vnstat works. (https://www.linuxquestions.org/questions/debian-26/%5Bsolved%5D-vnstat-d-w-m-all-return-no-data-available-but-vnstat-works-4175563505/)

mzsade 01-09-2016 02:28 PM

[Solved] vnstat -d,-w,-m all return "no data available" but vnstat works.
 
It has been some time since i checked my bandwidth usage so i don't know if this is because i disabled NetworkManager.service a few weeks ago.
Today when all the above vnstat options returned "no data available" (i've dealt with Not enough data available before), while vnstat without options did throw up some data, i did this:
Code:

:~# systemctl enable vnstat
Synchronizing state of vnstat.service with SysV init with /lib/systemd/systemd-sysv-install...
Executing /lib/systemd/systemd-sysv-install enable vnstat
:~# systemctl start vnstat
:~# pgrep -c vnstatd
1

Still no joy so;
Code:

:~$ sudo vnstat -u -i eth0
and yet;
Code:

:~$ vnstat
Database updated: Sun Jan 10 01:19:29 2016

    (eth0) since 

          rx:  8.45 GiB      tx:  603.28 MiB      total:  9.04 GiB

  monthly
                    rx      |    tx      |    total    |  avg. rate
    ------------------------+-------------+-------------+---------------
      Jan '70      8.45 GiB |  603.28 MiB |    9.04 GiB |    0.05 kbit/s
    ------------------------+-------------+-------------+---------------
    estimated        15 MiB |      1 MiB |      16 MiB |

  daily
                    rx      |    tx      |    total    |  avg. rate
    ------------------------+-------------+-------------+---------------
              Qb    924.96 MiB |  47.27 MiB |  972.23 MiB |  92.18 kbit/s
              |    114.61 MiB |    3.78 MiB |  118.39 MiB |  203.37 kbit/s
    ------------------------+-------------+-------------+---------------
    estimated      2.03 GiB |      54 MiB |    2.08 GiB |
:~$ vnstat -d

  (eth0)  /  daily

        day        rx      |    tx      |    total    |  avg. rate
    ------------------------+-------------+-------------+---------------
                          no data available
    ------------------------+-------------+-------------+---------------

:~:~$ vnstat -w

  (eth0)  /  weekly

                      rx      |    tx      |    total    |  avg. rate
  ---------------------------+-------------+-------------+---------------
                          no data available
  ---------------------------+-------------+-------------+---------------
sade@Sinai:~$ vnstat -m

  (eth0)  /  monthly

      month        rx      |    tx      |    total    |  avg. rate
    ------------------------+-------------+-------------+---------------
                          no data available
    ------------------------+-------------+-------------+--

Code:

:~$ LC_ALL=C vnstat
Database updated: Sun Jan 10 01:49:29 2016

    (eth0) since 01/01/70

          rx:  8.46 GiB      tx:  606.00 MiB      total:  9.05 GiB

  monthly
                    rx      |    tx      |    total    |  avg. rate
    ------------------------+-------------+-------------+---------------
      Jan '70      8.46 GiB |  606.00 MiB |    9.05 GiB |    0.05 kbit/s
    ------------------------+-------------+-------------+---------------
    estimated        15 MiB |      1 MiB |      16 MiB |

  daily
                    rx      |    tx      |    total    |  avg. rate
    ------------------------+-------------+-------------+---------------
    yesterday    924.96 MiB |  47.27 MiB |  972.23 MiB |  92.18 kbit/s
        today    121.20 MiB |    6.51 MiB |  127.71 MiB |  159.26 kbit/s
    ------------------------+-------------+-------------+---------------
    estimated      1.56 GiB |      79 MiB |    1.64 GiB |

Could someone please tell me what's going on here?

unSpawn 01-10-2016 05:11 AM

No idea but I'd first check what 'vnstat --dumpdb' returns? Should be 89 lines. Then what does 'vnstat --debug -d' return?

mzsade 01-10-2016 06:35 AM

I should have remembered to mention i am using OpenDNS servers, sorry; also noticed i don't have the </var/log/vnstat> or </run/vnstat> directories. Added the opendns nameservers in /run/resolvconf/interfaces/eth0 and rebooted, nothing, the files in the DatabaseDir "/var/lib/vnstat/eth0" are unreadable (there's two of them)..seriously, i'm out of my depth here..:cry:

Code:

:~$ vnstat --dumpdb
version;3
active;1
interface;eth0:~$ vnstat --dumpdb
version;3
active;1
interface;eth0
nick;
created;0
updated;1452425706
totalrx;9739
totaltx;658
currx;355450880
curtx;22209536
totalrxk;232
totaltxk;145
btime;1452404361
d;0;1452364464;1200;58;440;664;0
d;1;1452314400;924;47;981;277;0
nick;
created;0
updated;1452425706
totalrx;9739
totaltx;658
currx;355450880
curtx;22209536
totalrxk;232
totaltxk;145
btime;1452404361
d;0;1452364464;1200;58;440;664;0
d;1;1452314400;924;47;981;277;0
d;2;1452191456;319;24;823;151;0
d;3;1452105110;680;52;978;210;0
d;4;1452018638;644;83;555;266;0
d;5;1451932426;1131;68;921;109;0
d;6;1451845994;2236;163;25;371;0
d;7;1451759651;1690;90;694;963;0
d;8;1451675559;820;57;561;615;0
d;9;1451638642;89;12;289;606;0
d;10;0;0;0;109;9;0
d;11;0;0;0;0;0;0
d;12;0;0;0;0;0;0
d;13;0;0;0;0;0;0
d;14;0;0;0;0;0;0
d;15;0;0;0;0;0;0
d;16;0;0;0;0;0;0
d;17;0;0;0;0;0;0
d;18;0;0;0;0;0;0
d;19;0;0;0;0;0;0
d;20;0;0;0;0;0;0
d;21;0;0;0;0;0;0
d;22;0;0;0;0;0;0
d;23;0;0;0;0;0;0
d;24;0;0;0;0;0;0
d;25;0;0;0;0;0;0
d;26;0;0;0;0;0;0
d;27;0;0;0;0;0;0
d;28;0;0;0;0;0;0
d;29;0;0;0;0;0;0
m;0;0;9739;658;232;145;0
m;1;0;0;0;0;0;0
m;2;0;0;0;0;0;0
m;3;0;0;0;0;0;0
m;4;0;0;0;0;0;0
m;5;0;0;0;0;0;0
m;6;0;0;0;0;0;0
m;7;0;0;0;0;0;0
m;8;0;0;0;0;0;0
m;9;0;0;0;0;0;0
m;10;0;0;0;0;0;0
m;11;0;0;0;0;0;0
t;0;1451845994;2236;163;25;371;0
t;1;1451759651;1690;90;694;963;0
t;2;1451932426;1131;68;921;109;0
t;3;1452314400;924;47;981;277;0
t;4;1451675559;820;57;561;615;0
t;5;1452105110;680;52;978;210;0
t;6;1452018638;644;83;555;266;0
t;7;1452191456;319;24;823;151;0
t;8;1451638642;89;12;289;606;0
t;9;0;0;0;109;9;0
h;0;1452367769;120847;4025
h;1;1452371369;9077;3188
h;2;1452374970;93685;5478
h;3;1452378579;412002;12080
h;4;1452382179;160217;4587
h;5;1452383680;78;67
h;6;0;0;0
h;7;1452392837;24129;2733
h;8;1452396438;17180;1872
h;9;1452400054;25219;1903
h;10;1452403355;25301;2901
h;11;1452407380;380;161
h;12;1452410699;8723;1451
h;13;1452414300;15703;2958
h;14;1452417901;74458;6262
h;15;1452421505;141459;5891
h;16;1452425106;104786;4342
h;17;1452425706;1738;649
h;18;1452346194;23780;3904
h;19;1452349794;69183;3532
h;20;1452353395;71554;4761
h;21;1452356701;141346;4703
h;22;1452360512;132483;4081
h;23;1452364164;145236;7611
:~$ vnstat --debug -d
Config file: /etc/vnstat.conf
  c: Interface "eth0"
  -> "Interface": "eth0"
  c: DatabaseDir "/var/lib/vnstat"
  -> "DatabaseDir": "/var/lib/vnstat"
  c: Locale "-"
  -> "Locale": "-"
  i: MonthRotate 1
  -> "MonthRotate": 1
  c: DayFormat    "%x"
  -> "DayFormat": "%x"
  c: MonthFormat  "%b '%y"
  -> "MonthFormat": "%b '%y"
  c: TopFormat    "%x"
  -> "TopFormat": "%x"
  c: RXCharacter      "%"
  -> "RXCharacter": "%"
  c: TXCharacter      ":"
  -> "TXCharacter": ":"
  c: RXHourCharacter  "r"
  -> "RX  -> "RXHourCharacter": "r"
  c: TXHourCharacter  "t"
  -> "TXHourCharacter": "t"
  i: UnitMode 0
  -> "UnitMode": 0
  i: OutputStyle 3
  -> "OutputStyle": 3
  i: RateUnit 1
  -> "RateUnit": 1
  i: BandwidthDetection 1
  -> "BandwidthDetection": 1
  i: MaxBandwidth 1000
  -> "MaxBandwidth": 1000
  i: Sampletime 5
  -> "Sampletime": 5
  i: QueryMode 0
  -> "QueryMode": 0
  i: CheckDiskSpace 1
  -> "CheckDiskSpace": 1
  i: UseFileLocking 1  -> "RXHourCharacter": "r"
  c: TXHourCharacter  "t"
  -> "TXHourCharacter": "t"
  i: UnitMode 0
  -> "UnitMode": 0
  i: OutputStyle 3
  -> "OutputStyle": 3
  i: RateUnit 1
  -> "RateUnit": 1
  i: BandwidthDetection 1
  -> "BandwidthDetection": 1
  i: MaxBandwidth 1000
  -> "MaxBandwidth": 1000
  i: Sampletime 5
  -> "Sampletime": 5
  i: QueryMode 0
  -> "QueryMode": 0
  i: CheckDiskSpace 1
  -> "CheckDiskSpace": 1
  i: UseFileLocking 1HourCharacter": "r"
  c: TXHourCharacter  "t"
  -> "TXHourCharacter": "t"
  i: UnitMode 0
  -> "UnitMode": 0
  i: OutputStyle 3
  -> "OutputStyle": 3
  i: RateUnit 1
  -> "RateUnit": 1
  i: BandwidthDetection 1
  -> "BandwidthDetection": 1
  i: MaxBandwidth 1000
  -> "MaxBandwidth": 1000
  i: Sampletime 5
  -> "Sampletime": 5
  i: QueryMode 0
  -> "QueryMode": 0
  i: CheckDiskSpace 1
  -> "CheckDiskSpace": 1
  i: UseFileLocking 1
  -> "UseFileLocking": 1
  i: BootVariation 15
  -> "BootVariation": 15
  i: TrafficlessDays 1
  -> "TrafficlessDays": 1
  c: DaemonUser ""
  -> "DaemonUser" with no value, keeping default.
  c: DaemonGroup ""
  -> "DaemonGroup" with no value, keeping default.
  i: UpdateInterval 30
  -> "UpdateInterval": 30
  i: PollInterval 5
  -> "PollInterval": 5
  i: SaveInterval 5
  -> "SaveInterval": 5
  i: OfflineSaveInterval 30
  -> "OfflineSaveInterval": 30
  i: BandwidthDetectionInterval 5
  -> "BandwidthDetectionInterval": 5
  i: SaveOnStatusChange 1
  -> "SaveOnStatusChange": 1
  i: UseLogging 2
  -> "UseLogging": 2
  i: CreateDirs 1
  -> "CreateDirs": 1
  i: UpdateFileOwner 1
  -> "UpdateFileOwner": 1
  c: LogFile "/var/log/vnstat/vnstat.log"
  -> "LogFile": "/var/log/vnstat/vnstat.log"
  c: PidFile "/run/vnstat/vnstat.pid"
  -> "PidFile": "/run/vnstat/vnstat.pid"
  c: HeaderFormat "%x %H:%M"
  -> "HeaderFormat": "%x %H:%M"
  i: HourlyRate 1
  -> "HourlyRate": 1
  i: SummaryRate 1
  -> "SummaryRate": 1
  i: SummaryLayout 1
  -> "SummaryLayout": 1
  i: TransparentBg 0
  ->  -> "TransparentBg": 0
  c: CBackground    "FFFFFF"
  -> "CBackground": "FFFFFF"
  c: CEdge          "AEAEAE"
  -> "CEdge": "AEAEAE"
  c: CHeader        "606060"
  -> "CHeader": "606060"
  c: CHeaderTitle    "FFFFFF"
  -> "CHeaderTitle": "FFFFFF"
  c: CHeaderDate    "FFFFFF"
  -> "CHeaderDate": "FFFFFF"
  c: CText          "000000"
  -> "CText": "000000"
  c: CLine          "B0B0B0"
  -> "CLine": "B0B0B0"
  c: CLineL          "-"
  -> "CLineL": "-"
  c: CRx            "92CF00"
  -> "CRx": "92CF00"
  c: CTx            "606060" "TransparentBg": 0
  c: CBackground    "FFFFFF"
  -> "CBackground": "FFFFFF"
  c: CEdge          "AEAEAE"
  -> "CEdge": "AEAEAE"
  c: CHeader        "606060"
  -> "CHeader": "606060"
  c: CHeaderTitle    "FFFFFF"
  -> "CHeaderTitle": "FFFFFF"
  c: CHeaderDate    "FFFFFF"
  -> "CHeaderDate": "FFFFFF"
  c: CText          "000000"
  -> "CText": "000000"
  c: CLine          "B0B0B0"
  -> "CLine": "B0B0B0"
  c: CLineL          "-"
  -> "CLineL": "-"
  c: CRx            "92CF00"
  -> "CRx": "92CF00"
  c: CTx            "606060"
  -> "CTx": "606060"
  c: CRxD            "-"
  -> "CRxD": "-"
  c: CTxD            "-"
  -> "CTxD": "-"
Config file: /etc/vnstat.conf
ibw:  1: i"ethnone" l8 f8 r0 d0 
arg 1: "--debug"
arg 2: "-d"
Dir OK
1 file(s) found
db: Database loaded for interface "eth0"...

  (eth0)  /  daily

        day        rx      |    tx      |    total    |  avg. rate
    ------------------------+-------------+-------------+---------------
                          no data available
    ------------------------+-------------+-------------+---------------


unSpawn 01-10-2016 07:04 PM

Quote:

Originally Posted by mzsade (Post 5475932)
I should have remembered to mention i am using OpenDNS servers,

DNS has nothing to do with this, basically vnstat wants to read some /proc and /sys entries for gathering statistics.


Quote:

Originally Posted by mzsade (Post 5475932)
also noticed i don't have the </var/log/vnstat> or </run/vnstat> directories.

Please read the %{application}.conf manual pages: you don't need /var/log/vnstat unless you set the configuration option. And /run/vnstat will be created by systemd's /etc/tmpfiles.d/vnstat.conf or equivalent.


Quote:

Originally Posted by mzsade (Post 5475932)
the files in the DatabaseDir "/var/lib/vnstat/eth0" are unreadable (there's two of them)..seriously, i'm out of my depth here.

If you mean running 'file' on those files returns "data", yes, that's what the "--dumpdb" arg is for, no need reading the file with an editor or such. Now your version of vnstat may be different than mine, as I said "--dumpdb" returns 89 lines on two completely different Linux distros so I'd say contact the vnstat developer for help, see humdi.net/vnstat/ for contact details.

mzsade 01-12-2016 01:55 AM

Thank you for the link, and the commands, already got a reply!
Hi,

was vnStat compiled + installed from the source package or using some
Debian provided (apt-get etc.) binary package?

Your --dumpdb output on the forum looks a little bit corrupted but I'm not
sure if it's due to some copy/paste error or an actual problem in the
database. The fact that the database claims to be created in 1970 at least
suggest something is wrong.

The outputs of the following commands could provide some clues:

1) vnstat --iflist
2) ps aux | grep vnstat
3) ls -la /var/lib/vnstat

-Teemu
To which:
Code:

:~$ vnstat --iflist
Available interfaces: eth0 (100 Mbit) lo

Code:

sade@Sinai:~$ ps aux | grep vnstat
vnstat    643  0.0  0.0  7360  1924 ?        Ss  09:07  0:01 /usr/sbin/vnstatd -n
sade      7491  0.0  0.0  12728  2280 pts/0    S+  12:51  0:00 grep vnstat

Code:

:~$ ls -la /var/lib/vnstat
total 16
drwxr-xr-x  2 vnstat vnstat 4096 Jan 11 18:52 .
drwxr-xr-x 54 root  root  4096 Jan 11 18:50 ..
-rw-r--r--  1 vnstat vnstat 2792 Jan 11 18:52 eth0
-rw-r--r--  1 root  root  2792 Jan 11 18:52 .eth0

Since i last wrote, purged vnstat, force removed the /var/lib/vnstat directory and reinstalled vnstat. That got rid of the "no database available" message but now everything is stuck at 4KiB and i've already downloaded more than 500MB since then.
Code:

:~$ LC_ALL=C vnstat
Database updated: Mon Jan 11 18:52:32 2016

  eth0 since 01/11/16

          rx:  2 KiB      tx:  2 KiB      total:  4 KiB

  monthly
                    rx      |    tx      |    total    |  avg. rate
    ------------------------+-------------+-------------+---------------
      Jan '16        2 KiB |      2 KiB |      4 KiB |    0.00 kbit/s
    ------------------------+-------------+-------------+---------------
    estimated        --    |      --    |      --    |

  daily
                    rx      |    tx      |    total    |  avg. rate
    ------------------------+-------------+-------------+---------------
      01/11/16        2 KiB |      2 KiB |      4 KiB |    0.00 kbit/s
    ------------------------+-------------+-------------+---------------
    estimated        --    |      --    |      --    |


mzsade 01-13-2016 04:56 PM

Purged vnstat once again and installed from source as per http://humdi.net/wiki/vnstat/install/in_debian. Why this works while installing with apt-get did not is beyond me but there it is. It even took care of the locale issue that i used to have before when i had to "LC_ALL=C" for vnstat -d.

Code:

:~$ vnstat -d

 eth0  /  daily

        day        rx      |    tx      |    total    |  avg. rate
    ------------------------+-------------+-------------+---------------
    Wednesday 13 January 2016  18.94 MiB |    0.98 MiB |  19.92 MiB |    1.89 kbit/s
    Thursday 14 January 2016  83.75 MiB |    5.51 MiB |  89.26 MiB |  48.21 kbit/s
    ------------------------+-------------+-------------+---------------
    estimated      474 MiB |      28 MiB |    502 MiB |



All times are GMT -5. The time now is 05:40 PM.