2012-06-12 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* include/functions_forecast.php
	 include/ajax/agent.php
	 include/functions_ui.php
	 godmode/reporting/reporting_builder.list_items.php
	 godmode/reporting/reporting_builder.php
	 godmode/reporting/reporting_builder.item_editor.php: Fixes in 
	 forecasting reports (avoid php timeout) and empty inventory report.
	 Also fixed bug with autorefresh an referer check.
	 
	 Merged from branches.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6501 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2012-06-12 09:21:02 +00:00
parent d5f305e8d4
commit e5b71b53ee
7 changed files with 82 additions and 29 deletions

View File

@ -1,3 +1,16 @@
2012-06-12 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_forecast.php
include/ajax/agent.php
include/functions_ui.php
godmode/reporting/reporting_builder.list_items.php
godmode/reporting/reporting_builder.php
godmode/reporting/reporting_builder.item_editor.php: Fixes in
forecasting reports (avoid php timeout) and empty inventory report.
Also fixed bug with autorefresh an referer check.
Merged from branches.
2012-06-12 Vanessa Gil <vanessa.gil@artica.es>
* include/functions_config.php: Fixed bug: update password

View File

@ -93,7 +93,7 @@ switch ($action) {
$actionParameter = 'update';
$item = db_get_row_filter('treport_content', array('id_rc' => $idItem));
$server_name = $item ['server_name'];
// Metaconsole db connection
if (($config ['metaconsole'] == 1) && ($server_name != '')) {
$connection = metaconsole_get_connection($server_name);
@ -482,8 +482,10 @@ html_print_input_hidden('id_item', $idItem);
$agent_name = '';
if (metaconsole_load_external_db($connection) == NOERR)
$agent_name = db_get_value_filter('nombre', 'tagente', array('id_agente' => $idAgent));
$agent_name = db_get_value_filter('nombre', 'tagente', array('id_agente' => $idAgent));
// Append server name
if (!empty($agent_name))
$agent_name .= ' (' . $server_name . ')';
//Restore db connection
metaconsole_restore_db();
}
@ -1442,6 +1444,7 @@ function chooseType() {
case 'event_report_group':
$("#row_description").show();
$("#row_period").show();
$("#row_servers").show();
$("#row_group").show();
$("#row_show_in_two_columns").show();
break;
@ -1650,6 +1653,7 @@ function chooseType() {
break;
case 'group_report':
$("#row_group").show();
$("#row_servers").show();
break;
case 'top_n':
$("#row_description").show();
@ -1685,7 +1689,7 @@ function chooseType() {
$("#row_agent_multi").show();
$("#row_module_multi").show();
$("#row_show_in_two_columns").show();
$("#row_servers").show();
$("#id_agents").change(agent_changed_by_multiple_agents_inventory);
$("#id_agents").trigger('change');
@ -1705,6 +1709,8 @@ function chooseType() {
$("#id_agents").change(agent_changed_by_multiple_agents_inventory);
$("#id_agents").trigger('change');
$("#row_servers").show();
$("#combo_group").change(function() {
$('#hidden-date_selected').val('');
updateInventoryDates();

View File

@ -273,10 +273,7 @@ foreach ($items as $item) {
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
// Don't skip SLA or top N or general report items
if (($item['type'] != 'SLA') and ($item['type'] != 'top_n') and ($item['type'] != 'general')
and ($item['type'] != 'exception') and ($item['type'] != 'group_report'))
continue;
}
}
@ -320,7 +317,7 @@ foreach ($items as $item) {
$row[6] .= '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=edit&id_report=' . $idReport . '&id_item=' . $item['id_rc'] . '">' . html_print_image("images/wrench_orange.png", true, array("title" => __('Edit'))) . '</a>';
$row[6] .= '&nbsp;&nbsp;';
$row[6] .= '<a onClick="if (!confirm (\'Are you sure?\')) return false" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=delete&id_report=' . $idReport . '&id_item=' . $item['id_rc'] . $urlFilter . '">' . html_print_image("images/cross.png", true, array("title" => __('Delete'))) .'</a>';
$row[6] .= '<a onClick="if (!confirm (\'Are you sure?\')) return false;" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=delete&id_report=' . $idReport . '&id_item=' . $item['id_rc'] . $urlFilter . '">' . html_print_image("images/cross.png", true, array("title" => __('Delete'))) .'</a>';
$row[7] = '';
//You can sort the items if the filter is not enable.

View File

@ -467,11 +467,33 @@ switch ($action) {
// If metaconsole is activated
if ($config['metaconsole'] == 1) {
$id_gs = substr ($values['id_gs'], 0, strpos ($values['id_gs'], '|'));
if ($id_gs !== false) {
$server_name = strstr($values ['id_gs'], '|');
$values ['id_gs'] = $id_gs;
$values['server_name'] = substr ($server_name, 1, strlen($server_name));
if ($values['type'] == 'custom_graph') {
$id_gs = substr ($values['id_gs'], 0, strpos ($values['id_gs'], '|'));
if ($id_gs !== false) {
$server_name = strstr($values ['id_gs'], '|');
$values ['id_gs'] = $id_gs;
$values['server_name'] = substr ($server_name, 1, strlen($server_name));
}
}
// Get agent and server name
$agent_name_server = io_safe_output(get_parameter('agent'));
if (isset($agent_name_server)) {
$separator_pos = strpos($agent_name_server, '(');
if (($separator_pos != false) and ($separator_pos != 0)) {
$server_name = substr($agent_name_server, $separator_pos);
$server_name = str_replace('(', '', $server_name);
$server_name = str_replace(')', '', $server_name);
// Will update server_name variable
$values['server_name'] = trim($server_name);
$agent_name = substr($agent_name_server, 0, $separator_pos);
}
}
}
@ -496,7 +518,7 @@ switch ($action) {
$style['show_in_two_columns'] = get_parameter('show_in_two_columns', 0);
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
$values['style'] = io_safe_input(json_encode($style));
if ($good_format){
$resultOperationDB = db_process_sql_update('treport_content', $values, array('id_rc' => $idItem));
}
@ -616,11 +638,16 @@ switch ($action) {
$resultOperationDB = false;
break;
}
$id_gs = substr ($values['id_gs'], 0, strpos ($values['id_gs'], '|'));
if ($id_gs !== false && $id_gs !== '') {
$server_name = strstr($values ['id_gs'], '|');
$values ['id_gs'] = $id_gs;
$values['server_name'] = substr ($server_name, 1, strlen($server_name));
if ($config['metaconsole'] == 1) {
if ($values['type'] == 'custom_graph') {
$id_gs = substr ($values['id_gs'], 0, strpos ($values['id_gs'], '|'));
if ($id_gs !== false && $id_gs !== '') {
$server_name = strstr($values ['id_gs'], '|');
$values ['id_gs'] = $id_gs;
$values['server_name'] = substr ($server_name, 1, strlen($server_name));
}
}
}
if (($values['type'] == 'sql') OR ($values['type'] == 'sql_graph_hbar')

View File

@ -193,6 +193,7 @@ elseif ($search_agents_2 && ($config['metaconsole'] == 1)) {
return;
}
$data = array();
foreach ($servers as $server) {
if (metaconsole_load_external_db ($server) != NOERR) {
continue;
@ -227,7 +228,6 @@ elseif ($search_agents_2 && ($config['metaconsole'] == 1)) {
if ($agents === false)
continue;
$data = array();
foreach ($agents as $agent) {
$data[] = array('id' => $agent['id_agente'],
'name' => io_safe_output($agent['nombre']) . " (" . io_safe_output($server['server_name']) . ") ",
@ -235,9 +235,10 @@ elseif ($search_agents_2 && ($config['metaconsole'] == 1)) {
}
//Restore db connection
metaconsole_restore_db();
echo json_encode($data);
}
echo json_encode($data);
return;
}
?>

View File

@ -60,7 +60,7 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
$agent_interval = 300;
$cont = 1;
$data = array();
$table->data = array();
//$table->data = array();
// Creates data for calculation
foreach ($module_data as $utimestamp => $row) {
@ -93,7 +93,7 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
$last_timestamp = $utimestamp;
$cont++;
array_push($table->data, $data);
//array_push($table->data, $data);
}
$cont--;
@ -197,11 +197,12 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
}
// Using this function for prediction_date
if ($prediction_period == false){
// These statements stop the prediction when interval is greater than 4 years
if ($current_ts - $last_timestamp >= 126144000){
// These statements stop the prediction when interval is greater than 2 years
if ($current_ts - $last_timestamp >= 94608000){
return false;
}
//html_debug_print(" Date " . $timestamp_f . " data: " . $output_data[$timestamp_f]);
// Found it
if ($max_value >= $output_data[$timestamp_f] and $min_value <= $output_data[$timestamp_f]){
return $current_ts;
@ -231,6 +232,6 @@ function forecast_prediction_date ($module_id, $period = 5184000, $max_value = 0
if ($min_value > $max_value){
return false;
}
return forecast_projection_graph($module_id, $period, false, $max_value, $min_value);
}

View File

@ -1023,7 +1023,15 @@ function ui_process_page_head ($string, $bitfield) {
if ($config["refr"] > 0) {
$query = ui_get_url_refresh (false);
$output .= '<meta http-equiv="refresh" content="'.$config["refr"].'; URL='.$query.'" />';
$HTTP_REFERER = '';
if (isset($_SERVER['HTTP_REFERER']))
$HTTP_REFERER = '&HTTP_REFERER=' . $_SERVER['HTTP_REFERER'];
else if (isset($_GET['HTTP_REFERER']))
$HTTP_REFERER = '&HTTP_REFERER=' . $_GET['HTTP_REFERER'];
$output .= '<meta http-equiv="refresh" content="'.$config["refr"].'; URL='.$query. $HTTP_REFERER .'" />';
}
$output .= "\n\t";
$output .= '<title>Pandora FMS - '.__('the Flexible Monitoring System').'</title>