Displaying graphs correctly with non-default step

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
yid
Cacti User
Posts: 83
Joined: Sat Apr 20, 2002 8:26 pm

Displaying graphs correctly with non-default step

Post by yid »

Don't know how many people are interested in this, but atleast I'll be able to find it next time I re-install cacti.

If the step of your RRD is different than the default, you'll need to modify the rrd_functions.php a little bit.

In the "rrdtool_function_graph" function, modify the timespan variable to read as follows:

Code: Select all

$timespan = (mysql_query(sql_id_rra, 0, "rows") * mysql_query($sql_id_rra, 0, "steps") * <whatever your step is>);
Last edited by yid on Sat Aug 31, 2002 7:36 am, edited 1 time in total.
gaurav
Posts: 15
Joined: Fri Aug 30, 2002 8:28 am

Post by gaurav »

Yid,

A few questions.
1) Why is this required?
2) Is this applicable for version 0.6.8?
3) I generate only two graphs which have different step. How would this effect the other graphs?
4) Are you suggesting that line 318 of rrd_functions.php be modified? From 0.6.8, below is what I have as the code.
$timespan = -(mysql_result($sql_id_rra, 0, "rows") * mysql_result($sql_id_rra, 0, "steps") * 144);
Thanks,
- Gaurav
yid
Cacti User
Posts: 83
Joined: Sat Apr 20, 2002 8:26 pm

Post by yid »

> 1) Why is this required?
The way it is by default, the $timespan is equal to:
(the number of entires in an RRA) * (the number of steps in each entry) * 144 (144 seconds =2.4 minutes).
This becomes the number of seconds, negative from now. The start time of your graph.
In my configuration, I'm using 5 second steps, so this calculation gives me the wrong RRA to look at entirely.

> 2) Is this applicable for version 0.6.8?
I have checked both 0.67, and 0.68 and they both require this. However, if your step is not so different from this cacti default, no change should be required.

> 3) I generate only two graphs which have different step. How would this effect the other graphs?
I think this is something that needs to be looked at.
If you have largely different steps it could make a difference. Run the numbers, and see whether or not it would matter to you.
Ultimately, I think we'd want to be able to pass the a step variable from the graph configuration (as different datasources may have different steps) to the rrd_function.php. While we're at it we could also pass a graph_start (already there), and graph_end for creation of custom graphs.

> 4) Are you suggesting that line 318 of rrd_functions.php be modified?
yup.

Aaron
Guest

Post by Guest »

Thanks for the reply Aaron, but this does not seems to work for me here.
Parse error: parse error, unexpected ')' in /usr/local/apache2/2.0.40/htdocs/cacti/include/rrd_functions.php on line 318

Warning: Cannot add header information - headers already sent by (output started at /usr/local/apache2/2.0.40/htdocs/cacti/include/rrd_functions.php:318) in /usr/ local/apache2/2.0.40/htdocs/cacti/ds.php on line 161
yid
Cacti User
Posts: 83
Joined: Sat Apr 20, 2002 8:26 pm

Post by yid »

Sorry :oops: syntax error. I've corrected it above. I left out the first parenthesis. The line again is:

Code: Select all

$timespan = -(mysql_result($sql_id_rra, 0, "rows") * mysql_result($sql_id_rra, 0, "steps") * 5);
for a five second step
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest