Nlbwmon does not survive reboot

I am facing an issue with nlwbmon on D Link N300.
Config is default and monitor works as long as there is no reboot.

After reboot it looks like:

root@OpenWrt:~# ls -ltr /var/lib/nlbwmon


root@OpenWrt:~# ps | grep nlbw
1254 root 1320 SN /usr/sbin/nlbwmon -o /var/lib/nlbwmon -b 524288 -i 24h -r 30s -p /usr/share/nlbwmon/protocols -G 10 -I 1 -L 10000 -Z -s -s -s -s -s fd91:d774:b


root@OpenWrt:~# nlbw -c list

after restarting the service, everything looks fine.

nlbw -c show -t 2020-11-01

But only kb recorded - history is lost.

Am I missing some important config? Or is it "works as designed" and nlbw doesn't keep history after reboot?

Cheers, Frood

The default database dir is defined as /var/lib/nlbwmon which is on RAM disk (as /var is normally /tmp in OpenWrt), so naturally it does not survive a reboot.

As a general rule, OpenWrt defaults usually avoid writing to flash, and you pretty much always need to specifically configure it if you want something written to permanent storage.


Awesome - good to know why. Thanks.
Just like in another thread, changing this value helps out.
Changed it to

option database_directory /usr/share/nlbwmon/

1 Like

As @hnyman mentioned, writing to RAM is intentional, as Flash memory of routers isn't designed for frequent writing, and you may wear it prematurely.

You could possibly use a USB stick if your router is expensive and you don't want to possibly shorten its life.

Luckily nlbwmon is pretty conservative by default, and only writes one per day to the disk. The data is kept in RAM for the configured interval, and then written to the disk (and even that is /var RAMdisk by default).