jow- / nlbwmon

Simple conntrack based traffic accounting
ISC License
154 stars 34 forks source link

Cannot view older accounting periods #25

Closed Ziginox closed 5 years ago

Ziginox commented 5 years ago

When trying to view data for prior accounting periods, the graphs in LuCI, the graphs just re-animate but the data on the page does not change. In the system log, this message appears:

Sat Jan 12 16:53:07 2019 daemon.err nlbwmon[10274]: Unable to handle 'dump' command: No error information Sat Jan 12 16:53:07 2019 daemon.err uhttpd[1592]: Error while processing command: No data available

The databases are still there and can be viewed with the 'nlbw' command. This happens on both mvebu and x86 hardware, in both 17.01 and 18.06.

Aktanusa commented 5 years ago

I have this same issue. I'm on x86-64 of 18.06.1. I can use the nlbw to get the data also.

Edit: I have placed the data at /varperm/lib/nlbwmon/

Aktanusa commented 5 years ago

Okay, I did some debugging and I found out the root cause. The page has a bug in which it parses periods using the unreliable Date string constructor which doesn't take timezone into account (depending on which browser you use). So unless your timezone is set to GMT+0, the time from the parser is always wrong, either 1 day ahead or 1 day behind. So when the wrong parameter is sent, nlbw throws and error since that period doesn't exist.

Edit: I'm trying to work a fix now.

Aktanusa commented 5 years ago

Okay here is the fix if you don't want to wait for my pull request I'm about to do:

Add this after line 431 in /usr/lib/lua/luci/view/nlbw/display.htm:

d1 = new Date(d1.getTime() + (d1.getTimezoneOffset() * 60000));

Edit: Technically this isn't a nlbwmon bug, but a luci-app-nlbwmon bug.

Edit 2: I've done a bigger patch with more fixes which you can see here: openwrt/luci#2496

jow- commented 5 years ago

Fixed via bd56c1aac650c9d60d9f66bb0c923b0346f3fa41 in luci.git