Luci_statistics data loss after upgrade


I like and use luci_statistics. I had a data loss after upgrade to latest release. No historical data now.

What I need to do better for next upgrade?

The rrds reside in RAM, therefore need to be saved and restored.

1 Like

So also reboot will purge history.
Howto save and restore? Can I export to plaintext files (git)?

The easiest solution would be to use a USB flash drive (assuming your router has a USB port) to add some permanent storage.

OpenWrt Project: Quick Start for Adding a USB drive provides instructions of how to set up a USB drive.


thanks. Done that.

/dev/sda2 7.1G 32.6M 6.7G 0% /mnt/sda2

How to save all state now on /mnt/sda2?

Write a script that

  • periodically copies the rrds on /tmp to your external drive (e.g. every 15...60min, depending on how big your pain is when some data is lost)
  • on reboot, copies the rrds from your external drive to the correct location on /tmp

Or you can configure RRDtool output plugin in luci by going to Statistics > Setup then clicking the output plugins tab. You can then just change the rrd storage directory to one on the mounted drive.

1 Like

thank you guys

I did that, if someone else is interested:

Edit 2022-05-10: Moved from Github Gists to proper Github repository.

Just change BACKUP_DIR to whatever is suitable in your situation. Flash wear wise, I feel comfortable to backup it to internal flash every 6 hours, your opinion might differ.



I have added a link to your script on


But I think the solution from @krazeh is much more simple and elegant.

Am I wrong?