Graphs FROM / TO value rounded to multiple of 5 mins

Hello,

I would like to change the default calculation methods for graph “from” and “to” timestamps. It appears that right now, the value is rounded to the last multiple of 5 minutes, which makes perfectly sense when the RRD are setup with the default 5 minutes interval.
But it would be interesting to round the value to whatever interval is set in the RRD config, so that when you have RRD to the minute, the graphs are also showing, by default, up to the last poll.
08
(current time here is 9:41 but the value is rounded to the last multiple of 5 minutes).

I did not find yet where this 5 minutes “round” is done. If somebody has the information, I would write the PR for this.

Thanx

For the datepicker: html/includes/print-date-selector.inc.php
For the rrd itself (from= and to= in the url): html/pages/graphs.inc.php

Found it :wink:

in includes/definitions.inc.php : config[‘time’][‘now’] -= config[‘time’][‘now’] % 300

But unfortunately, this includes/definitions.inc.php seems to be loaded earlier than the RRD STEP value, which means I cannot access it.

Any clue ?

Thanx.

try with config['time']['now'] -= config['time']['now'] % $config['rrd']['step']

Maybe try in the processConfig() function

Hi again,

The value is clearly not yet in the config hash. So there is no way to do it in a clean way without changing all the order in which the files are loaded in ProcessConfig(). And I won’t go in that direction because it may break other things.

So for now, I simply override, in my config.php file, the ‘now’ value with time() and that does the trick.

Bye and thanx for help.

Hi everybody!

@PipoCanaja could please share the exact config line you change?

I’ve been looking for this configuration can’t find it. This 5 min rounded is bothering me…I’m starting a librenms deploy, adopting a 1 min polling and the default behavior is not helping.

Thanks,
Audrey

HI @arbaldin
The hack described here is not applicable anymore. I’ll put that in my todolist : find a new way to achieve this :slight_smile:
Bye