From 5667b3fd68be759120b3c8cfa33160dc4f98ceb9 Mon Sep 17 00:00:00 2001 From: Ian Berry Date: Fri, 3 Sep 2004 00:36:09 +0000 Subject: [PATCH] fix data query graph variable substitution bug (bug#0000285) git-svn-id: svn+ssh://repo.cacti.net/var/data/svnroot/cacti/trunk/cacti@2052 860744bd-22fc-0310-8c96-e9fe5004b5ca --- lib/rrd.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/rrd.php b/lib/rrd.php index ec8af3363c..57b665bce5 100644 --- a/lib/rrd.php +++ b/lib/rrd.php @@ -739,7 +739,14 @@ function rrdtool_function_graph($local_graph_id, $rra_id, $graph_data_array, $rr /* data query variables */ if (preg_match("/\|query_[a-zA-Z0-9_]+\|/", $graph_variables[$field_name][$graph_item_id])) { - $graph_variables[$field_name][$graph_item_id] = substitute_snmp_query_data($graph_variables[$field_name][$graph_item_id], $graph["host_id"], $graph["snmp_query_id"], $graph["snmp_index"]); + /* default to the graph data query information from the graph */ + if (empty($graph_item["local_data_id"])) { + $graph_variables[$field_name][$graph_item_id] = substitute_snmp_query_data($graph_variables[$field_name][$graph_item_id], $graph["host_id"], $graph["snmp_query_id"], $graph["snmp_index"]); + /* use the data query information from the data source if possible */ + }else{ + $data_local = db_fetch_row("select snmp_index,snmp_query_id,host_id from data_local where id='" . $graph_item["local_data_id"] . "'"); + $graph_variables[$field_name][$graph_item_id] = substitute_snmp_query_data($graph_variables[$field_name][$graph_item_id], $data_local["host_id"], $data_local["snmp_query_id"], $data_local["snmp_index"]); + } } /* 95th percentile */