Luci statistics: extend graphs to multiple yeras

hi guys,

i installed openwrt/lede years ago on my router.
in addition i installed the luci statistics based on collectd and rrd-tool.
even after hours of trial and error i am not able to extend the default timespan of one year to multiple years.
if anyone would be so kind to help me out and/or point me to the right direction i'd be thankful.

installed packages:

  1. Install luci-app-statistics
    opkg install luci-app-statistics
  2. List out supported plugins for collectd
    opkg list | grep collectd-mod
  3. Install desired plugins
    opkg install collectd-mod-cpu collectd-mod-interface collectd-mod-memory collectd-mod-ping collectd-mod-rrdtool collectd-mod-wireless
  4. Enable init script
    /etc/init.d/luci_statistics enable
    /etc/init.d/collectd enable

as you can see:
statistics are deleted after one year, even though the graph is set to two years.
i guess the .rrd file needs some adaption.

02

You will likely need to define a longer time period for the RRD database. It constantly rotates the data according to your specificiation...

Global original defaults in
https://github.com/openwrt/luci/blob/master/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/rrdtool.lua#L68

In LuCI config in a live router:

Statistics / Setup / Output plugins / RRDTool

Stored timespans  = 1hour 1day 1week 1month 1year

And in your config file /etc/config/luci_statistics:

# output plugins

config statistics 'collectd_rrdtool'
        option enable '1'
        option DataDir '/tmp/rrd'
        option RRARows '100'
        option RRASingle '1'
        option RRATimespans '1hour 1day 1week 1month 1year'

Hard to find in config file?

hi,

so do i need to change that configuration file (defaults) or do i have to change/modify the *.rrd files if i dont want to lose previous stats?

I am not quite sure how the old data will be handled. It is possible that you will lose the old data, so it is best to backup that first.

You need to at least modify the config file (via LuCI or text editor), and then restart luci_statistics.

But I have never tried to add a new longer period there, so I am not quite sure how the existing files will be handled if the time period definitions do change. Possibly the new data period will be just added, or alternatively the old data is destroyed.

You probably know that at already, but it is pretty easy to see inside the RRD files (and even manipulate the data) with rrdtool app. You might practice making and restoring RRD backups with it.

I tested on my own router and added a new period "3year" and restarted the statistics. It runs ok, but does not add new data to the database. It is possible that new data would be added when the next minor time period get filled, but I doubt.

I tried with 3year (a long one) and 8hour (a short one), but neither produced more data in the database, at least initially.

Luci shows a graph for the 8 hour data definition, but that is probably taken from the 1day data.

I guess that you are on your own to google for RRD database handling advice, good choices are probably the rrdtool site plus collectd site.