Changing RRD scaling.
-
I wanted to alter the RRD scales. Default graphs are 4 hours, 16 hours, 48 hours, 1 month etc. I wanted to have 4 hours, 1 day, 1 week, 1 month.
I eventually figured it out, so I thought I'd post the fix here. I saw some other questions of this ilk, but the threads were locked.
The answer lies in two files. Back these up before continuing.
cp /usr/local/www/status_rrd_graph_img.php /usr/local/www/status_rrd_graph_img.bak cp /usr/local/www/status_rrd_graph.php /usr/local/www/status_rrd_graph.bak
In /usr/local/www/status_rrd_graph_img.php
Change this line:
$periods = array("4h", "16h", "48h", "32d", "6m", "16m");
to
$periods = array("4h", "24h", "7d", "32d", "6m", "16m");
Lower down, change this block
$graphs['16h']['seconds'] = 57600; $graphs['16h']['average'] = 60; $graphs['16h']['scale'] = "MINUTE:30:HOUR:1:HOUR:1:0:%H"; $graphs['48h']['seconds'] = 172800; $graphs['48h']['average'] = 300; $graphs['48h']['scale'] = "HOUR:1:HOUR:6:HOUR:2:0:%H";
to
$graphs['24h']['seconds'] = 86400; $graphs['24h']['average'] = 60; $graphs['24h']['scale'] = "MINUTE:30:HOUR:1:HOUR:1:0:%H"; $graphs['7d']['seconds'] = 604800; $graphs['7d']['average'] = 600; $graphs['7d']['scale'] = "HOUR:1:HOUR:12:DAY:1:0:%a";
Now in /usr/local/www/status_rrd_graph.php
Change$periods = array("4h", "16h", "48h", "32d", "6m", "16m");
to
$periods = array("4h", "24h", "7d", "32d", "6m", "16m");
Reload the page and the graphs will update with the new ranges. Personally I think these are better defaults, but your mileage may vary. It would definitely be nice to have control over these graphs in the WebGui …
Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.