Ejemplo n.º 1
0
function update_data_source_data_query_cache($local_data_id) {
	$host_id = db_fetch_cell("select host_id from data_local where id=$local_data_id");

	$field = data_query_field_list(db_fetch_cell("select
		data_template_data.id
		from data_template_data
		where data_template_data.local_data_id=$local_data_id"));

	if (empty($field)) { return; }

	$data_query_id = db_fetch_cell("select snmp_query_id from snmp_query_graph where id='" . $field["output_type"] . "'");

	$index = data_query_index($field["index_type"], $field["index_value"], $host_id, $data_query_id);

	if (($data_query_id != "0") && ($index != "")) {
		db_execute("update data_local set snmp_query_id='$data_query_id',snmp_index='$index' where id='$local_data_id'");

		/* update data source title cache */
		update_data_source_title_cache($local_data_id);
	}
}
Ejemplo n.º 2
0
function update_data_source_data_query_cache($local_data_id)
{
    $host_id = db_fetch_cell("SELECT host_id FROM data_local WHERE id={$local_data_id}");
    $field = data_query_field_list(db_fetch_cell("select\n\t\tdata_template_data.id\n\t\tfrom data_template_data\n\t\twhere data_template_data.local_data_id={$local_data_id}"));
    if (empty($field)) {
        return;
    }
    $data_query_id = db_fetch_cell("SELECT snmp_query_id FROM snmp_query_graph WHERE id='" . $field["output_type"] . "'");
    $index = data_query_index($field["index_type"], $field["index_value"], $host_id, $data_query_id);
    if ($data_query_id != "0" && $index != "") {
        db_execute("UPDATE data_local SET snmp_query_id='{$data_query_id}',snmp_index='{$index}' WHERE id='{$local_data_id}'");
        /* update data source title cache */
        update_data_source_title_cache($local_data_id);
    }
}