Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1063076 - vnstat does not show hourly, weekly or monthly history in reports
Summary: vnstat does not show hourly, weekly or monthly history in reports
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: vnstat
Version: 20
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Adrian Reber
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-02-09 22:40 UTC by Jason Burgess
Modified: 2015-06-29 15:07 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-06-29 15:07:01 UTC


Attachments (Terms of Use)
Debug output from hour query on command line. (deleted)
2014-02-09 22:40 UTC, Jason Burgess
no flags Details

Description Jason Burgess 2014-02-09 22:40:18 UTC
Created attachment 861170 [details]
Debug output from hour query on command line.

Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Create database from scratch to be sure non-corruption.
2. Add interface either from command line or config file.
3. Start vnstatd (/usr/sbin/vnstatd -d) and let run for at least a day.


Actual results:

- "vnstat --hours" -> <interface>: Not enough data available yet.

In fact, even after a months of logging the error will always be regarding not enough data available for hourly, weekly and monthly summaries. However, *current* monthly summary works - but only the *current* month. Once the month rolls over, the history is lost.

Debug output from hour query on command line attached.

Expected results:


Additional info:

Comment 1 Jason Burgess 2014-03-01 15:22:35 UTC
OK, this seems to be a permission issue... update here:

1. as root, create new database with "vnstat -u -i p32p1" (in my case)

Error: Unable to read database "/var/lib/vnstat/p32p1".
Info: -> A new database has been created.

2. note that /var/lib/vnstat is owned by vnstat:

drwxr-xr-x 2 vnstat vnstat 4096 Mar  1 11:06 /var/lib/vnstat/

3. note that /var/lib/vnstat/p32p1 is owned by root:

-rw-r--r-- 1 root root 2792 Mar  1 11:04 p32p1

3. start vnstatd in daemon mode

/var/lib/vnstat# systemctl start vnstat
/var/lib/vnstat# systemctl status vnstat
vnstat.service - VnStat - Lightweight Network Traffic Monitor
   Loaded: loaded (/usr/lib/systemd/system/vnstat.service; enabled)
   Active: active (running) since Sat 2014-03-01 11:08:19 AST; 6s ago
 Main PID: 379 (vnstatd)
   CGroup: /system.slice/vnstat.service
           └─379 /usr/sbin/vnstatd -d

4. Note the vnstatd process is running as user "vnstat"

vnstat     379     1  0 11:08 ?        00:00:00 /usr/sbin/vnstatd -d

5. execute vnstat to check on data collected:

/var/lib/vnstat# vnstat
 p32p1: Not enough data available yet.

6. stop vnstatd, change permissions on file to be owned by "vnstat:vnstat" and restart daemon

/var/lib/vnstat# chown vnstat:vnstat p32p1 
/var/lib/vnstat# ls -l
total 4
-rw-r--r-- 1 vnstat vnstat 2792 Mar  1 11:04 p32p1

<note error on shutdown when database was owned by root>
Mar  1 11:11:11 jacknife2 vnstatd[379]: SIGTERM received, exiting.
Mar  1 11:11:11 jacknife2 vnstatd[379]: Error: Unable to write database "/var/lib/vnstat/p32p1".

<new startup, note new PID>
Mar  1 11:11:41 jacknife2 vnstatd[514]: Monitoring: p32p1 

7. take some time to allow data to accumlate and:

[11:14 AM] root@jacknife2:/var/lib/vnstat# vnstat
Database updated: Sat Mar  1 11:13:55 2014

   p32p1 since 03/01/14

          rx:  4.44 MiB      tx:  0.98 MiB      total:  5.42 MiB

   monthly
                     rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
       Mar '14      4.44 MiB |    0.98 MiB |    5.42 MiB |    1.10 kbit/s
     ------------------------+-------------+-------------+---------------
     estimated        --     |      --     |      --     |

   daily
                     rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
         today      4.44 MiB |    0.98 MiB |    5.42 MiB |    1.10 kbit/s
     ------------------------+-------------+-------------+---------------
     estimated        --     |      --     |      --     |



So this seems to be a permission issue on database creation. The write to database error should occur to /var/log/messages in realtime and not at the end of the shutdown of the process, IMO.

Comment 2 Jason Burgess 2014-03-01 15:38:41 UTC
Scratch the comment about the error occuring in realtime.. turns out it was and I just didn't see it in my logs. Note the error occuring, as it should, each database write interval (default 5 minutes).

Mar  1 09:36:29 jacknife2 vnstatd[966]: Error: Unable to write database "/var/lib/vnstat/p32p1".
Mar  1 09:41:29 jacknife2 vnstatd[966]: Error: Unable to write database "/var/lib/vnstat/p32p1".
Mar  1 09:46:29 jacknife2 vnstatd[966]: Error: Unable to write database "/var/lib/vnstat/p32p1".

So beyond changing the permissions of the database file post-creation, is there some way to ensure vnstatd can write to the database file after creation? I would assume most people when configuring this tool will be doing so as the root user and thus will run into the same permissions issue.... and we don't really want to run vnstatd as root....

Comment 3 Teemu Toivola 2014-09-02 19:44:14 UTC
(In reply to Jason Burgess from comment #2)
> So beyond changing the permissions of the database file post-creation, is
> there some way to ensure vnstatd can write to the database file after
> creation?

The 1.12 upstream release supports specifying which user/group the daemon should run as and is configured by default to ensure that the specified user/group has correct permissions for the database directory and the databases (when started as root).

One other feature worth noticing is that the daemon can automatically create databases for all available non-loopback interfaces when started with an empty database directory (or starting from 1.12, no database directory at all). From a new user point of view, simply starting the daemon should be enough in most cases.

Comment 4 Fedora End Of Life 2015-05-29 10:52:12 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Fedora End Of Life 2015-06-29 15:07:01 UTC
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.