mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
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:
parent
d5f305e8d4
commit
e5b71b53ee
@ -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>
|
2012-06-12 Vanessa Gil <vanessa.gil@artica.es>
|
||||||
|
|
||||||
* include/functions_config.php: Fixed bug: update password
|
* include/functions_config.php: Fixed bug: update password
|
||||||
|
@ -93,7 +93,7 @@ switch ($action) {
|
|||||||
$actionParameter = 'update';
|
$actionParameter = 'update';
|
||||||
$item = db_get_row_filter('treport_content', array('id_rc' => $idItem));
|
$item = db_get_row_filter('treport_content', array('id_rc' => $idItem));
|
||||||
$server_name = $item ['server_name'];
|
$server_name = $item ['server_name'];
|
||||||
|
|
||||||
// Metaconsole db connection
|
// Metaconsole db connection
|
||||||
if (($config ['metaconsole'] == 1) && ($server_name != '')) {
|
if (($config ['metaconsole'] == 1) && ($server_name != '')) {
|
||||||
$connection = metaconsole_get_connection($server_name);
|
$connection = metaconsole_get_connection($server_name);
|
||||||
@ -482,8 +482,10 @@ html_print_input_hidden('id_item', $idItem);
|
|||||||
$agent_name = '';
|
$agent_name = '';
|
||||||
|
|
||||||
if (metaconsole_load_external_db($connection) == NOERR)
|
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
|
//Restore db connection
|
||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
}
|
}
|
||||||
@ -1442,6 +1444,7 @@ function chooseType() {
|
|||||||
case 'event_report_group':
|
case 'event_report_group':
|
||||||
$("#row_description").show();
|
$("#row_description").show();
|
||||||
$("#row_period").show();
|
$("#row_period").show();
|
||||||
|
$("#row_servers").show();
|
||||||
$("#row_group").show();
|
$("#row_group").show();
|
||||||
$("#row_show_in_two_columns").show();
|
$("#row_show_in_two_columns").show();
|
||||||
break;
|
break;
|
||||||
@ -1650,6 +1653,7 @@ function chooseType() {
|
|||||||
break;
|
break;
|
||||||
case 'group_report':
|
case 'group_report':
|
||||||
$("#row_group").show();
|
$("#row_group").show();
|
||||||
|
$("#row_servers").show();
|
||||||
break;
|
break;
|
||||||
case 'top_n':
|
case 'top_n':
|
||||||
$("#row_description").show();
|
$("#row_description").show();
|
||||||
@ -1685,7 +1689,7 @@ function chooseType() {
|
|||||||
$("#row_agent_multi").show();
|
$("#row_agent_multi").show();
|
||||||
$("#row_module_multi").show();
|
$("#row_module_multi").show();
|
||||||
$("#row_show_in_two_columns").show();
|
$("#row_show_in_two_columns").show();
|
||||||
|
$("#row_servers").show();
|
||||||
$("#id_agents").change(agent_changed_by_multiple_agents_inventory);
|
$("#id_agents").change(agent_changed_by_multiple_agents_inventory);
|
||||||
$("#id_agents").trigger('change');
|
$("#id_agents").trigger('change');
|
||||||
|
|
||||||
@ -1705,6 +1709,8 @@ function chooseType() {
|
|||||||
$("#id_agents").change(agent_changed_by_multiple_agents_inventory);
|
$("#id_agents").change(agent_changed_by_multiple_agents_inventory);
|
||||||
$("#id_agents").trigger('change');
|
$("#id_agents").trigger('change');
|
||||||
|
|
||||||
|
$("#row_servers").show();
|
||||||
|
|
||||||
$("#combo_group").change(function() {
|
$("#combo_group").change(function() {
|
||||||
$('#hidden-date_selected').val('');
|
$('#hidden-date_selected').val('');
|
||||||
updateInventoryDates();
|
updateInventoryDates();
|
||||||
|
@ -273,10 +273,7 @@ foreach ($items as $item) {
|
|||||||
$connection = metaconsole_get_connection($server_name);
|
$connection = metaconsole_get_connection($server_name);
|
||||||
if (metaconsole_load_external_db($connection) != NOERR) {
|
if (metaconsole_load_external_db($connection) != NOERR) {
|
||||||
//ui_print_error_message ("Error connecting to ".$server_name);
|
//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] .= '<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] .= ' ';
|
$row[6] .= ' ';
|
||||||
$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] = '';
|
$row[7] = '';
|
||||||
//You can sort the items if the filter is not enable.
|
//You can sort the items if the filter is not enable.
|
||||||
|
@ -467,11 +467,33 @@ switch ($action) {
|
|||||||
|
|
||||||
// If metaconsole is activated
|
// If metaconsole is activated
|
||||||
if ($config['metaconsole'] == 1) {
|
if ($config['metaconsole'] == 1) {
|
||||||
$id_gs = substr ($values['id_gs'], 0, strpos ($values['id_gs'], '|'));
|
if ($values['type'] == 'custom_graph') {
|
||||||
if ($id_gs !== false) {
|
$id_gs = substr ($values['id_gs'], 0, strpos ($values['id_gs'], '|'));
|
||||||
$server_name = strstr($values ['id_gs'], '|');
|
if ($id_gs !== false) {
|
||||||
$values ['id_gs'] = $id_gs;
|
$server_name = strstr($values ['id_gs'], '|');
|
||||||
$values['server_name'] = substr ($server_name, 1, strlen($server_name));
|
$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_two_columns'] = get_parameter('show_in_two_columns', 0);
|
||||||
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
|
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
|
||||||
$values['style'] = io_safe_input(json_encode($style));
|
$values['style'] = io_safe_input(json_encode($style));
|
||||||
|
|
||||||
if ($good_format){
|
if ($good_format){
|
||||||
$resultOperationDB = db_process_sql_update('treport_content', $values, array('id_rc' => $idItem));
|
$resultOperationDB = db_process_sql_update('treport_content', $values, array('id_rc' => $idItem));
|
||||||
}
|
}
|
||||||
@ -616,11 +638,16 @@ switch ($action) {
|
|||||||
$resultOperationDB = false;
|
$resultOperationDB = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$id_gs = substr ($values['id_gs'], 0, strpos ($values['id_gs'], '|'));
|
|
||||||
if ($id_gs !== false && $id_gs !== '') {
|
if ($config['metaconsole'] == 1) {
|
||||||
$server_name = strstr($values ['id_gs'], '|');
|
if ($values['type'] == 'custom_graph') {
|
||||||
$values ['id_gs'] = $id_gs;
|
$id_gs = substr ($values['id_gs'], 0, strpos ($values['id_gs'], '|'));
|
||||||
$values['server_name'] = substr ($server_name, 1, strlen($server_name));
|
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')
|
if (($values['type'] == 'sql') OR ($values['type'] == 'sql_graph_hbar')
|
||||||
|
@ -193,6 +193,7 @@ elseif ($search_agents_2 && ($config['metaconsole'] == 1)) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$data = array();
|
||||||
foreach ($servers as $server) {
|
foreach ($servers as $server) {
|
||||||
if (metaconsole_load_external_db ($server) != NOERR) {
|
if (metaconsole_load_external_db ($server) != NOERR) {
|
||||||
continue;
|
continue;
|
||||||
@ -227,7 +228,6 @@ elseif ($search_agents_2 && ($config['metaconsole'] == 1)) {
|
|||||||
if ($agents === false)
|
if ($agents === false)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$data = array();
|
|
||||||
foreach ($agents as $agent) {
|
foreach ($agents as $agent) {
|
||||||
$data[] = array('id' => $agent['id_agente'],
|
$data[] = array('id' => $agent['id_agente'],
|
||||||
'name' => io_safe_output($agent['nombre']) . " (" . io_safe_output($server['server_name']) . ") ",
|
'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
|
//Restore db connection
|
||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
|
|
||||||
echo json_encode($data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo json_encode($data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -60,7 +60,7 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
|
|||||||
$agent_interval = 300;
|
$agent_interval = 300;
|
||||||
$cont = 1;
|
$cont = 1;
|
||||||
$data = array();
|
$data = array();
|
||||||
$table->data = array();
|
//$table->data = array();
|
||||||
|
|
||||||
// Creates data for calculation
|
// Creates data for calculation
|
||||||
foreach ($module_data as $utimestamp => $row) {
|
foreach ($module_data as $utimestamp => $row) {
|
||||||
@ -93,7 +93,7 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
|
|||||||
$last_timestamp = $utimestamp;
|
$last_timestamp = $utimestamp;
|
||||||
$cont++;
|
$cont++;
|
||||||
|
|
||||||
array_push($table->data, $data);
|
//array_push($table->data, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cont--;
|
$cont--;
|
||||||
@ -197,11 +197,12 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
|
|||||||
}
|
}
|
||||||
// Using this function for prediction_date
|
// Using this function for prediction_date
|
||||||
if ($prediction_period == false){
|
if ($prediction_period == false){
|
||||||
// These statements stop the prediction when interval is greater than 4 years
|
// These statements stop the prediction when interval is greater than 2 years
|
||||||
if ($current_ts - $last_timestamp >= 126144000){
|
if ($current_ts - $last_timestamp >= 94608000){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//html_debug_print(" Date " . $timestamp_f . " data: " . $output_data[$timestamp_f]);
|
//html_debug_print(" Date " . $timestamp_f . " data: " . $output_data[$timestamp_f]);
|
||||||
|
|
||||||
// Found it
|
// Found it
|
||||||
if ($max_value >= $output_data[$timestamp_f] and $min_value <= $output_data[$timestamp_f]){
|
if ($max_value >= $output_data[$timestamp_f] and $min_value <= $output_data[$timestamp_f]){
|
||||||
return $current_ts;
|
return $current_ts;
|
||||||
@ -231,6 +232,6 @@ function forecast_prediction_date ($module_id, $period = 5184000, $max_value = 0
|
|||||||
if ($min_value > $max_value){
|
if ($min_value > $max_value){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return forecast_projection_graph($module_id, $period, false, $max_value, $min_value);
|
return forecast_projection_graph($module_id, $period, false, $max_value, $min_value);
|
||||||
}
|
}
|
||||||
|
@ -1023,7 +1023,15 @@ function ui_process_page_head ($string, $bitfield) {
|
|||||||
|
|
||||||
if ($config["refr"] > 0) {
|
if ($config["refr"] > 0) {
|
||||||
$query = ui_get_url_refresh (false);
|
$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 .= "\n\t";
|
||||||
$output .= '<title>Pandora FMS - '.__('the Flexible Monitoring System').'</title>
|
$output .= '<title>Pandora FMS - '.__('the Flexible Monitoring System').'</title>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user