2011-06-01 Javier Lanz <javier.lanz@artica.es>
* include/functions_graph.php: Fixed a deprecated function call * include/functions_reporting.php: Fixed a deprecated function call and removed some connection error messages * include/functions.php: Disabled agents/modules report type when metaconsole is active * operation/agentes/ver_agente.php: Removed some connection error messages * godmode/reporting/reporting_builder.list_items.php: Removed some connection error messages * godmode/reporting/reporting_builder.php: Added getting server name for sql reports & custom graph in metaconsole * godmode/reporting/reporting_builder.item_editor.php: Added Server combo box, custom graph for metaconsole & removed some connection error messages git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4394 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
cf1e4703af
commit
e096e30c67
|
@ -1,3 +1,19 @@
|
|||
2011-06-01 Javier Lanz <javier.lanz@artica.es>
|
||||
|
||||
* include/functions_graph.php: Fixed a deprecated function call
|
||||
* include/functions_reporting.php: Fixed a deprecated function call and
|
||||
removed some connection error messages
|
||||
* include/functions.php: Disabled agents/modules report type when
|
||||
metaconsole is active
|
||||
* operation/agentes/ver_agente.php: Removed some connection error messages
|
||||
* godmode/reporting/reporting_builder.list_items.php: Removed some
|
||||
connection error messages
|
||||
* godmode/reporting/reporting_builder.php: Added getting server name for
|
||||
sql reports & custom graph in metaconsole
|
||||
* godmode/reporting/reporting_builder.item_editor.php: Added Server
|
||||
combo box, custom graph for metaconsole & removed some connection error
|
||||
messages
|
||||
|
||||
2011-05-30 Javier Lanz <javier.lanz@artica.es>
|
||||
* include/functions_reporting.php: Edited "render_report_html" function
|
||||
to work with metaconsole printing metaconsole elements
|
||||
|
|
|
@ -28,8 +28,10 @@ $show_graph_options[1] = __('Table & Graph');
|
|||
$show_graph_options[2] = __('Only graph');
|
||||
|
||||
enterprise_include('/godmode/reporting/reporting_builder.item_editor.php');
|
||||
enterprise_include_once ('include/functions_metaconsole.php');
|
||||
require_once ($config['homedir'].'/include/functions_agents.php');
|
||||
if (enterprise_include_once ('include/functions_metaconsole.php')) {
|
||||
$servers = metaconsole_get_connection_names();
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
case 'new':
|
||||
|
@ -79,7 +81,7 @@ switch ($action) {
|
|||
if (($config ['metaconsole'] == 1) && ($server_name != '')) {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (!metaconsole_load_external_db($connection)) {
|
||||
ui_print_error_message ("Error connecting to ".$server_name);
|
||||
//ui_print_error_message ("Error connecting to ".$server_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -278,6 +280,11 @@ switch ($action) {
|
|||
break;
|
||||
}
|
||||
|
||||
//Restore db connection
|
||||
if (($config ['metaconsole'] == 1) && ($server_name != '')) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -393,16 +400,23 @@ html_print_input_hidden('id_item', $idItem);
|
|||
<td style="vertical-align: top;"><?php echo __('Custom graph'); ?></td>
|
||||
<td style="">
|
||||
<?php
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$query_sql = 'SELECT id_graph, name FROM tgraph WHERE private = 0 OR (private = 1 AND id_user = "'.$config["id_user"].'")';
|
||||
break;
|
||||
case "postgresql":
|
||||
case "oracle":
|
||||
$query_sql = 'SELECT id_graph, name FROM tgraph WHERE private = 0 OR (private = 1 AND id_user = \''.$config["id_user"].'\')';
|
||||
break;
|
||||
if ($config['metaconsole'] == 1) {
|
||||
$graphs = array();
|
||||
$graphs = metaconsole_get_custom_graphs();
|
||||
html_print_select ($graphs, 'id_custom_graph', $idCustomGraph, '', '--', 0);
|
||||
}
|
||||
else {
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$query_sql = 'SELECT id_graph, name FROM tgraph WHERE private = 0 OR (private = 1 AND id_user = "'.$config["id_user"].'")';
|
||||
break;
|
||||
case "postgresql":
|
||||
case "oracle":
|
||||
$query_sql = 'SELECT id_graph, name FROM tgraph WHERE private = 0 OR (private = 1 AND id_user = \''.$config["id_user"].'\')';
|
||||
break;
|
||||
}
|
||||
html_print_select_from_sql($query_sql, 'id_custom_graph', $idCustomGraph, '', '--', 0);
|
||||
}
|
||||
html_print_select_from_sql($query_sql, 'id_custom_graph', $idCustomGraph, '', '--', 0);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -414,6 +428,15 @@ html_print_input_hidden('id_item', $idItem);
|
|||
<td style="vertical-align: top;"><?php echo __('Query SQL'); ?></td>
|
||||
<td style=""><?php html_print_textarea('sql', 5, 25, $sql); ?></td>
|
||||
</tr>
|
||||
<tr id="row_servers" style="" class="datos">
|
||||
<td style="vertical-align: top;"><?php echo __('Server'); ?></td>
|
||||
<td style=""><?php
|
||||
if ($config ['metaconsole'] != 1)
|
||||
html_print_select ($servers, 'combo_server', $server_name, '', __('Select server'), 0, false, false, true, '', true);
|
||||
else
|
||||
html_print_select ($servers, 'combo_server', $server_name, '', __('Select server'), 0);
|
||||
?></td>
|
||||
</tr>
|
||||
<tr id="row_header" style="" class="datos">
|
||||
<td style="vertical-align: top;"><?php echo __('Serialized header') . '<a href="#" class="tip"> <span>' . __("The separator character is | .") . '</span></a>';?></td>
|
||||
<td style=""><?php html_print_input_text('header', $header, '', 40, 90); ?></td>
|
||||
|
@ -569,7 +592,8 @@ function print_SLA_list($width, $action, $idItem = null) {
|
|||
if (($config ['metaconsole'] == 1) && ($server_name != '')) {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (!metaconsole_load_external_db($connection)) {
|
||||
ui_print_error_message ("Error connecting to ".$server_name);
|
||||
//ui_print_error_message ("Error connecting to ".$server_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module']));
|
||||
|
@ -661,7 +685,8 @@ function print_General_list($width, $action, $idItem = null) {
|
|||
if (($config ['metaconsole'] == 1) && ($server_name != '')) {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (!metaconsole_load_external_db($connection)) {
|
||||
ui_print_error_message ("Error connecting to ".$server_name);
|
||||
//ui_print_error_message ("Error connecting to ".$server_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module']));
|
||||
|
@ -1011,6 +1036,7 @@ function chooseType() {
|
|||
$("#row_show_in_two_columns").css('display', 'none');
|
||||
$("#row_show_in_landscape").css('display', 'none');
|
||||
$("#row_module_group").css('display', 'none');
|
||||
$("#row_servers").css('display', 'none');
|
||||
|
||||
switch (type) {
|
||||
case 'event_report_group':
|
||||
|
@ -1097,6 +1123,7 @@ function chooseType() {
|
|||
$("#row_custom").css('display', '');
|
||||
$("#row_custom_example").css('display', '');
|
||||
$("#row_show_in_two_columns").css('display', '');
|
||||
$("#row_servers").css('display', '');
|
||||
break;
|
||||
case 'sql_graph_pie':
|
||||
$("#row_description").css('display', '');
|
||||
|
@ -1105,6 +1132,8 @@ function chooseType() {
|
|||
$("#row_custom_example").css('display', '');
|
||||
$("#row_show_in_two_columns").css('display', '');
|
||||
$("#row_show_in_landscape").css('display', '');
|
||||
$("#row_servers").css('display', '');
|
||||
|
||||
break;
|
||||
case 'sql_graph_hbar':
|
||||
$("#row_description").css('display', '');
|
||||
|
@ -1113,6 +1142,7 @@ function chooseType() {
|
|||
$("#row_custom_example").css('display', '');
|
||||
$("#row_show_in_two_columns").css('display', '');
|
||||
$("#row_show_in_landscape").css('display', '');
|
||||
$("#row_servers").css('display', '');
|
||||
break;
|
||||
case 'sql_graph_vbar':
|
||||
$("#row_description").css('display', '');
|
||||
|
@ -1121,6 +1151,7 @@ function chooseType() {
|
|||
$("#row_custom_example").css('display', '');
|
||||
$("#row_show_in_two_columns").css('display', '');
|
||||
$("#row_show_in_landscape").css('display', '');
|
||||
$("#row_servers").css('display', '');
|
||||
break;
|
||||
case 'url':
|
||||
$("#row_description").css('display', '');
|
||||
|
|
|
@ -270,8 +270,10 @@ foreach ($items as $item) {
|
|||
if (($config ['metaconsole'] == 1) && ($server_name != '')) {
|
||||
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (!metaconsole_load_external_db($connection))
|
||||
ui_print_error_message ("Error connecting to ".$server_name);
|
||||
if (!metaconsole_load_external_db($connection)) {
|
||||
//ui_print_error_message ("Error connecting to ".$server_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ($item['id_agent'] == 0) {
|
||||
|
|
|
@ -198,6 +198,20 @@ switch ($action) {
|
|||
$values['id_module_group'] = get_parameter('combo_modulegroup');
|
||||
$values['id_group'] = get_parameter ('combo_group');
|
||||
$values['server_name'] = get_parameter ('server_name');
|
||||
if ($values['server_name'] == '')
|
||||
$values['server_name'] = get_parameter ('combo_server');
|
||||
|
||||
if (($values['type'] == 'custom_graph') && ($values['id_gs'] == 0 || $values['id_gs'] == '')) {
|
||||
$resultOperationDB = false;
|
||||
break;
|
||||
}
|
||||
|
||||
$id_gs = strstr($values ['id_gs'], '|', true);
|
||||
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'] == 'sql') OR ($values['type'] == 'sql_graph_hbar')OR ($values['type'] == 'sql_graph_vbar') OR ($values['type'] == 'sql_graph_pie')) {
|
||||
$values['treport_custom_sql_id'] = get_parameter('id_custom');
|
||||
|
@ -277,6 +291,20 @@ switch ($action) {
|
|||
$values['id_module_group'] = get_parameter('combo_modulegroup');
|
||||
$values['id_group'] = get_parameter ('combo_group');
|
||||
$values['server_name'] = get_parameter ('server_name');
|
||||
if ($values['server_name'] == '')
|
||||
$values['server_name'] = get_parameter ('combo_server');
|
||||
|
||||
if (($values['type'] == 'custom_graph') && ($values['id_gs'] == 0 || $values['id_gs'] == '')) {
|
||||
$resultOperationDB = false;
|
||||
break;
|
||||
}
|
||||
|
||||
$id_gs = strstr($values ['id_gs'], '|', true);
|
||||
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'] == 'sql') OR ($values['type'] == 'sql_graph_hbar')OR ($values['type'] == 'sql_graph_vbar') OR ($values['type'] == 'sql_graph_pie')) {
|
||||
|
||||
|
|
|
@ -645,7 +645,8 @@ function get_report_types () {
|
|||
$types['general'] = __('General');
|
||||
$types['top_n'] = __('Top n');
|
||||
$types['exception'] = __('Exception');
|
||||
$types['agent_module'] = __('Agents/Modules');
|
||||
if ($config['metaconsole'] != 1)
|
||||
$types['agent_module'] = __('Agents/Modules');
|
||||
// $types['agent_detailed_event'] = __('Agent detailed event');
|
||||
// $types['list_events_module'] = __('List events of module');
|
||||
// $types['list_events_agent'] = __('List events of agent');
|
||||
|
|
|
@ -803,7 +803,7 @@ function graph_sla_slicebar ($id, $period, $sla_min, $sla_max, $date, $daysWeek
|
|||
global $config;
|
||||
|
||||
|
||||
$data = get_agentmodule_sla_array ($id, $period, $sla_min, $sla_max, $date, $daysWeek, $time_from, $time_to);
|
||||
$data = reporting_get_agentmodule_sla_array ($id, $period, $sla_min, $sla_max, $date, $daysWeek, $time_from, $time_to);
|
||||
$colors = array(1 => '#38B800', 2 => '#FFFF00', 3 => '#FF0000', 4 => '#C3C3C3');
|
||||
|
||||
return slicesbar_graph($data, $period, $width, $height, $colors, $config['fontpath'],
|
||||
|
|
|
@ -621,14 +621,14 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
|
|||
}
|
||||
|
||||
// Get previous data
|
||||
$previous_data = get_previous_data ($id_agent_module, $datelimit);
|
||||
$previous_data = modules_get_previous_data ($id_agent_module, $datelimit);
|
||||
if ($previous_data !== false) {
|
||||
$previous_data['utimestamp'] = $datelimit;
|
||||
array_unshift ($interval_data, $previous_data);
|
||||
}
|
||||
|
||||
// Get next data
|
||||
$next_data = get_next_data ($id_agent_module, $date);
|
||||
$next_data = modules_get_next_data ($id_agent_module, $date);
|
||||
if ($next_data !== false) {
|
||||
$next_data['utimestamp'] = $date;
|
||||
array_push ($interval_data, $next_data);
|
||||
|
@ -2017,8 +2017,9 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$server_name = $content ['server_name'];
|
||||
if (($config ['metaconsole'] == 1) && $server_name != '') {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (!metaconsole_load_external_db($connection))
|
||||
ui_print_error_message ("Error connecting to ".$server_name);
|
||||
if (!metaconsole_load_external_db($connection)){
|
||||
//ui_print_error_message ("Error connecting to ".$server_name);
|
||||
}
|
||||
}
|
||||
|
||||
$module_name = db_get_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']);
|
||||
|
@ -2200,8 +2201,10 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
//Metaconsole connection
|
||||
if (($config ['metaconsole'] == 1) && $server_name != '') {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (!metaconsole_load_external_db($connection))
|
||||
ui_print_error_message ("Error connecting to ".$server_name);
|
||||
if (!metaconsole_load_external_db($connection)) {
|
||||
//ui_print_error_message ("Error connecting to ".$server_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
//Get the sla_value in % and store it on $sla_value
|
||||
$sla_value = reporting_get_agentmodule_sla ($sla['id_agent_module'], $content['period'],
|
||||
|
@ -2904,8 +2907,10 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$server_name = $row ['server_name'];
|
||||
if (($config ['metaconsole'] == 1) && $server_name != '') {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (!metaconsole_load_external_db($connection))
|
||||
ui_print_error_message ("Error connecting to ".$server_name);
|
||||
if (!metaconsole_load_external_db($connection)) {
|
||||
//ui_print_error_message ("Error connecting to ".$server_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$mod_name = modules_get_agentmodule_name ($row['id_agent_module']);
|
||||
|
@ -2985,8 +2990,10 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$server_name = $general ['server_name'];
|
||||
if (($config ['metaconsole'] == 1) && $server_name != '') {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (!metaconsole_load_external_db($connection))
|
||||
ui_print_error_message ("Error connecting to ".$server_name);
|
||||
if (!metaconsole_load_external_db($connection)) {
|
||||
//ui_print_error_message ("Error connecting to ".$server_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$ag_name = modules_get_agentmodule_agent_name ($general ['id_agent_module']);
|
||||
|
@ -3029,6 +3036,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$connection = metaconsole_get_connection($server_name);
|
||||
if (!metaconsole_load_external_db($connection)) {
|
||||
//ui_print_error_message ("Error connecting to ".$server_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3076,8 +3084,10 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$server_name = $generals[$i]['server_name'];
|
||||
if (($config ['metaconsole'] == 1) && $server_name != '') {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (!metaconsole_load_external_db($connection))
|
||||
ui_print_error_message ("Error connecting to ".$server_name);
|
||||
if (!metaconsole_load_external_db($connection)) {
|
||||
//ui_print_error_message ("Error connecting to ".$server_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$min = reporting_get_agentmodule_data_average($generals[$i]['id_agent_module'], $content['period']);
|
||||
|
@ -3101,8 +3111,10 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$server_name = $g['server_name'];
|
||||
if (($config ['metaconsole'] == 1) && $server_name != '') {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (!metaconsole_load_external_db($connection))
|
||||
ui_print_error_message ("Error connecting to ".$server_name);
|
||||
if (!metaconsole_load_external_db($connection)) {
|
||||
//ui_print_error_message ("Error connecting to ".$server_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$value = reporting_get_agentmodule_data_average ($g['id_agent_module'], $content['period']);
|
||||
|
@ -3188,8 +3200,10 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$server_name = $row['server_name'];
|
||||
if (($config ['metaconsole'] == 1) && $server_name != '') {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (!metaconsole_load_external_db($connection))
|
||||
ui_print_error_message ("Error connecting to ".$server_name);
|
||||
if (!metaconsole_load_external_db($connection)) {
|
||||
//ui_print_error_message ("Error connecting to ".$server_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$ag_name = modules_get_agentmodule_agent_name($row ['id_agent_module']);
|
||||
|
@ -3423,8 +3437,10 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$server_name = $exceptions[$i]['server_name'];
|
||||
if (($config ['metaconsole'] == 1) && $server_name != '') {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (!metaconsole_load_external_db($connection))
|
||||
ui_print_error_message ("Error connecting to ".$server_name);
|
||||
if (!metaconsole_load_external_db($connection)) {
|
||||
//ui_print_error_message ("Error connecting to ".$server_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$min = reporting_get_agentmodule_data_average ($exceptions[$i]['id_agent_module'], $content['period']);
|
||||
|
@ -3444,8 +3460,10 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$server_name = $exc['server_name'];
|
||||
if (($config ['metaconsole'] == 1) && $server_name != '') {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (!metaconsole_load_external_db($connection))
|
||||
ui_print_error_message ("Error connecting to ".$server_name);
|
||||
if (!metaconsole_load_external_db($connection)) {
|
||||
//ui_print_error_message ("Error connecting to ".$server_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$ag_name = modules_get_agentmodule_agent_name ($exc ['id_agent_module']);
|
||||
|
|
|
@ -158,7 +158,8 @@ if (is_ajax ()) {
|
|||
//Metaconsole db connection
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (!metaconsole_load_external_db($connection)) {
|
||||
ui_print_error_message ("Error connecting to ".$server_name);
|
||||
//ui_print_error_message ("Error connecting to ".$server_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
//Get agent's modules
|
||||
|
|
Loading…
Reference in New Issue