function get_graph_title($local_graph_id) { $graph = db_fetch_row_prepared('SELECT graph_local.host_id, graph_local.snmp_query_id, graph_local.snmp_index, graph_templates_graph.local_graph_id, graph_templates_graph.title FROM (graph_templates_graph, graph_local) WHERE graph_templates_graph.local_graph_id = graph_local.id AND graph_local.id = ?', array($local_graph_id)); if (strstr($graph['title'], '|') && !empty($graph['host_id'])) { $graph['title'] = substitute_data_input_data($graph['title'], $graph, 0); return expand_title($graph['host_id'], $graph['snmp_query_id'], $graph['snmp_index'], $graph['title']); } else { return $graph['title']; } }
function rrd_substitute_host_query_data($txt_graph_item, $graph, $graph_item) { /* replace host variables in graph elements */ $host_id = 0; if (empty($graph["host_id"])) { /* if graph has no associated host determine host_id from graph item data source */ if (!empty($graph_item["local_data_id"])) { $host_id = db_fetch_cell("SELECT host_id FROM data_local WHERE id='" . $graph_item["local_data_id"] . "'"); } } else { $host_id = $graph["host_id"]; } $txt_graph_item = substitute_host_data($txt_graph_item, '|', '|', $host_id); /* replace query variables in graph elements */ if (preg_match("/\\|query_[a-zA-Z0-9_]+\\|/", $txt_graph_item)) { /* default to the graph data query information from the graph */ if (empty($graph_item["local_data_id"])) { $txt_graph_item = substitute_snmp_query_data($txt_graph_item, $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"] . "'"); $txt_graph_item = substitute_snmp_query_data($txt_graph_item, $data_local["host_id"], $data_local["snmp_query_id"], $data_local["snmp_index"]); } } /* replace query variables in graph elements */ if (preg_match("/\\|input_[a-zA-Z0-9_]+\\|/", $txt_graph_item)) { return substitute_data_input_data($txt_graph_item, $graph, $graph_item["local_data_id"]); } return $txt_graph_item; }
function get_graph_title($local_graph_id) { $graph = db_fetch_row("select\r\n\t\tgraph_local.host_id,\r\n\t\tgraph_local.snmp_query_id,\r\n\t\tgraph_local.snmp_index,\r\n\t\tgraph_templates_graph.local_graph_id,\r\n\t\tgraph_templates_graph.title\r\n\t\tfrom (graph_templates_graph,graph_local)\r\n\t\twhere graph_templates_graph.local_graph_id=graph_local.id\r\n\t\tand graph_local.id={$local_graph_id}"); if (strstr($graph["title"], "|") && !empty($graph["host_id"])) { $graph["title"] = substitute_data_input_data($graph["title"], $graph, 0); return expand_title($graph["host_id"], $graph["snmp_query_id"], $graph["snmp_index"], $graph["title"]); } else { return $graph["title"]; } }