In thold.php (line 136) there is this code, that chooses the oldest from the different graphs for a rrd, this will screw the graph you see when you do the following:
- Create a threshold for any rrd with two graphs (such as P95, bytes, bits or similar)
- Uncheck the box from propagate the values from template (editting the template)
- The graph you'll view when editing will always be the oldest one (in my case was the P95)
Code: Select all
$rrdsql = array_rekey(db_fetch_assoc("SELECT id FROM data_template_rrd WHERE local_data_id=$rra ORDER BY id"), "id", "id");
$sql = "task_item_id IN (" . implode(", ", $rrdsql) . ") AND graph_template_id>0";
$grapharr = db_fetch_assoc("SELECT DISTINCT local_graph_id FROM graph_templates_item WHERE $sql");
// Take the first one available
$graph = (isset($grapharr[0]["local_graph_id"]) ? $grapharr[0]["local_graph_id"] : "");
Wrong graphs shown in the preview and sent by email
Also when doing the same stuff as before and using custom values for the graph, the graph that is being send by email and shown in the graph view is wrong (altough the data from rrd is fine)
In my case I just fixed it directly in the database, but it was a single screwed graph.
But the reason for the wrong graph selected is the same as before, having two different task_item_id (one from an old graph and another from a newer one) makes $grapharr be filled with the oldest (LIMIT 1 + ORDER BY id) and ignore the others. This is the relevant code part.
thold_functions.php (line 2550)
Code: Select all
/* Get the Data Template, Graph Template, and Graph */
$rrdsql = db_fetch_row('SELECT id, data_template_id FROM data_template_rrd WHERE local_data_id=' . $save['rra_id'] . ' ORDER BY id');
$rrdlookup = $rrdsql['id'];
$grapharr = db_fetch_row("SELECT local_graph_id, graph_template_id FROM graph_templates_item WHERE task_item_id=$rrdlookup and local_graph_id <> '' LIMIT 1");