Bug 1757485

Summary: Vnstat fails to log traffic.
Product: [Fedora] Fedora EPEL Reporter: Erik Hedl <erik.hedl>
Component: vnstatAssignee: Adrian Reber <adrian>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: epel7CC: adrian
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-01 21:12:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Erik Hedl 2019-10-01 16:41:04 UTC
Description of problem:

Vnstat fails to log traffic. Queries on any interface result in the error message: "Not enough data available yet.". The underlying problem is that the /usr/lib/systemd/system/vnstat.service file is miss-configured.

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

1.15-2.el7

How reproducible:

100% always fails to report traffic.

Steps to Reproduce:
1. execute query: "vnstat -i <some interface> -<one of h|d|w|m>"
2.
3.

Actual results:
"vnstat -i <some interface> -<one of h|d|w|m>"
<some interface>: Not enough data available yet.

Expected results:
A report to standard out configured per the hour|day|week|month.

Additional info:

Solution: 
1) stop vnstat service.
2) disable vnstat service.
3) remove all files in "/var/lib/vnstat/".
4) edit the /usr/lib/systemd/system/vnstat.service file, replace "vnstat -n" with "vnstat -d". 
5) enable vnstat service.
6) start vnstat service.

Long term solution, change the package to invoke the daemon ( -d option).

Comment 1 Adrian Reber 2019-10-01 16:58:02 UTC
Hmm, this is strange. My vnstat.service files contains the following:

[Service]
User=vnstat
ExecStart=/usr/sbin/vnstatd -n
ExecReload=/bin/kill -HUP $MAINPID

It starts vnstatd (with a trailing d) and not daemonizing a service is the preferred way when using systemd.

As far as I see it, everything is set up correctly with the vnstat service file.


A new installed vnstat creates a /var/lib/vnstat directory which is owned by the user vnstat.

If I start vnstat with 'systemctl start vnstat' and wait 5 minutes the vnstatd daemon collects data and stores it in /var/lib/vnstat which can then be queried using vnstat (without d).

The only thing necessary is to wait 5 minutes or change the configuration file.

Does it work differently for you.