Nlbwmon starts counting traffic only when a new month starts

I have nlbwmon installed on several routers. They run 23.05 and it works OK.
I have it installed on a router running recent snapshot build with kernel 6.6.
On that router nlbwmon doesn't count any traffic when I flash the build compiled by me.
Once the new month starts like June this morning, nlbwmon starts counting the traffic for current month but it didn't get any stats for the previous month.
If I flash a new build it won't get any data till the month changes again.


Nlbwmon config

config nlbwmon
	option netlink_buffer_size '2500000'
	option commit_interval '24h'
	option refresh_interval '5m'
	option database_directory '/var/lib/nlbwmon'
	option database_generations '10'
	option database_interval '1'
	option database_limit '10000'
	option protocol_database '/usr/share/nlbwmon/protocols'
	list local_network '192.168.0.0/16'
	list local_network 'lan'

See the GitHub repo For configuration.

option database_interval '-14' captures each month in my config to capture from the 17th to the 16th of each month based on my ISP billing cycle.

1 Like

In my case I use the default setting option database_interval '1'.
@jow Can you help with this?

Nlbwmon based on your posted configuration is working as advertised. That is why I pointed you to the README.md. Your config is defective based on your expectations.

option commit_interval '24h'

  • update the current database stored in the database directory (/var/lib/nlbwmon) with data collected in the last 24Hrs. I personally use '1' to update my non volatile database hourly.

option database_directory '/var/lib/nlbwmon'

  • store each monthly database in /var/lib/nlbwmon note that this particular data location is volatile. ANY data residing will cease to exist on any reboot. If you want to make the database persistent, you need to point it instead to a non volatile location. ie. a USB drive for example.

option database_generations '10'

  • keep 10 monthly generations. After saving 10 monthly the oldest will be removed. The default is set for constrained systems. If you want to keep each monthhly database forever, set it to '0'.

option database_interval '1'

  • The default begins capturing data on the first day of each month. Used to set your ISP billing interval date. The default is fine if you want to capture each monthly database beginning the first of the current month.

If your expectation is to capture collected data persistenly beginning the first of each month on a monthly basis forever without losing up to 24 Hrs of in memory data should a system abend occur, you need to customize the noted options.

Going back to the GUI. It is only configured to display the current months data. ie. selecting say the database from Februrary in the dropdown will not display that data.

To do that you will have to use the 'nlbw' runtime as explained in the README.md

2 Likes

Thanks for your answer.
I definitely looked at the readme as I did in the past when I started using nlbwmon on some older systems where it worked with exactly the same settings I have in my config now. And it worked immediately after the system was rebooted and that were my expectations for this system too.
I expect it to start collecting data from the moment the router reboots not from the 1-st day of the next month, but it doesn't with current settings only on this device. All others work as I expect but maybe my logic and understandings are wrong.
At the moment I can only "force" it to start collecting the data ASAP, setting the Due Date to the next day and at midnight it will start collecting data for the current month.

The only setting I can think of that isn’t reflected in the /etc/config/nlbwmon configuration is in the GUI Configuration under the Accounting Period selector box. Are you using Day of Month or Fixed Interval

I use Day of month set to 1.


Currently I set it to 4 because if I set it to 1 no data is counted for the current month. On several other routers running 23.05 build it works with 1.