LUCI graphs: longer interval by default

I would like to see the 1 day span immediately when I browse to the collectd / rrd graphs, but I would still like the 1 hour span to be present as an option (so I don't want to remove the latter from the setup). Is this possible? I suspect if the intervals can be added to the setup in non-increasing order, the first one is probably the one shown by default? I'm afraid of shooting myself in the foot by trying this :wink:

Interesting question.
I do not remember anybody to have asked that earlier.

You should not change the order of the items in the database definition. The earlier/shorter periods are used to calculate the longer periods, so having long periods first would very likely destroy the internal calculation logic.

The approach could maybe be about presentation default period, not about database itself.

It is actually easy: just change the config option for that in the rrdtool section of the LuCI statistics config file.
The option default_timespan is not visible in LuCI GUI, so you need edit /etc/config_luci_statistics by hand.
Just change 2hour there to 1day.

I tested and works ok.

Here you can see the source code:

Ps. Naturally remember to set there a value not deviating from the defined database timespans.

5 Likes

Your notice to stick only to defined timespans is interesting: the factory setting of 2hour which you quote from your system, and which matches my system, is in fact undefined. :stuck_out_tongue:

But thanks for what's the clearly best answer to my question.

Defined for LuCI statistics in the same config file...

It's not there for me, I have a 1hour. Which is too short, hence my question.

Version 24.10.5, I didn't mess with this config before as far as I remember.

Depends a bit from how long ago your original config has been created.

It has been 2hour in the default config since Dec 2022.
If your config originates from older time, it may naturally still have the old value in the config file.

I hacked up my config long ago to add more intervals and reset the default (oh, looks like taller images, too). I recall that some change I made in the collectd_rrdtool stuff borked the rrdtool database, though, so I had to delete all my history and start over.

config statistics 'rrdtool'
        option default_timespan '1day'
        option image_width '600'
        option image_height '250'
        option image_path '/tmp/rrdimg'

config statistics 'collectd_rrdtool'
        option enable '1'
        option DataDir '/tmp/rrd'
        option RRARows '288'
        option RRASingle '0'
        option backup '1'
        list RRATimespans '1hour'
        list RRATimespans '4hour'
        list RRATimespans '8hour'
        list RRATimespans '1day'
        list RRATimespans '2day'
        list RRATimespans '1week'
        list RRATimespans '1month'
        list RRATimespans '1year'

Yeah, you can't change the recorded periods for an existing database. If you change them, you need to scrap the old database.

And after changing parameters, you need to stop collectd, and delete the old database, or the rrd continues to use the already existing database periods. The database overrides the possible new parameters.

(Earlier that scrapping was usual in sysupgrade in any case, as there was no backup mechanism built for the ramdisk based database. But nowadays there is , so it is possible to keep longer data available more easily)

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.