From 011b44a072d12af460ab8ac5cf17267c92d14755 Mon Sep 17 00:00:00 2001 From: vgilc Date: Thu, 22 Mar 2012 16:05:42 +0000 Subject: [PATCH] 2012-03-22 Vanessa Gil * pandoradb.sql pandoradb.postgreSQL.sql pandoradb.oracle.sql, extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql, extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql, extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql: added 'operation' to treport_content_item table. * godmode/reporting/reporting_builder.item_editor.php include/functions_reporting.php include/ajax/reporting.ajax.php include/javascript/pandora.js: Added operation: sum,max,min or avg to global reports. * images/sum.png images/avg.png images/min.png images/max.png: Added icons. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5819 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 21 +++ .../pandoradb_migrate_4.0.x_to_4.1.mysql.sql | 5 + .../pandoradb_migrate_4.0.x_to_4.1.oracle.sql | 5 + ...doradb_migrate_4.0.x_to_4.1.postgreSQL.sql | 6 + .../reporting_builder.item_editor.php | 36 ++++- pandora_console/images/avg.png | Bin 0 -> 382 bytes pandora_console/images/max.png | Bin 0 -> 845 bytes pandora_console/images/min.png | Bin 0 -> 778 bytes pandora_console/images/sum.png | Bin 0 -> 284 bytes .../include/ajax/reporting.ajax.php | 4 +- .../include/functions_reporting.php | 142 ++++++++++++++---- pandora_console/include/javascript/pandora.js | 2 + pandora_console/pandoradb.oracle.sql | 3 +- pandora_console/pandoradb.postgreSQL.sql | 3 +- pandora_console/pandoradb.sql | 1 + 15 files changed, 192 insertions(+), 36 deletions(-) create mode 100644 pandora_console/images/avg.png create mode 100644 pandora_console/images/max.png create mode 100644 pandora_console/images/min.png create mode 100644 pandora_console/images/sum.png diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 4abbafdff1..a023dace69 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,24 @@ +2012-03-22 Vanessa Gil + + * pandoradb.sql + pandoradb.postgreSQL.sql + pandoradb.oracle.sql, + extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql, + extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql, + extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql: added 'operation' + to treport_content_item table. + + * godmode/reporting/reporting_builder.item_editor.php + include/functions_reporting.php + include/ajax/reporting.ajax.php + include/javascript/pandora.js: Added operation: sum,max,min or avg to + global reports. + + * images/sum.png + images/avg.png + images/min.png + images/max.png: Added icons. + 2012-03-22 Sergio Martin * include/graphs/functions_pchart.php diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql index efd97b651e..b6362c0a34 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql @@ -187,3 +187,8 @@ UPDATE ttipo_modulo SET descripcion='Generic data incremental' WHERE id_tipo=4; ALTER TABLE `tusuario` ADD COLUMN `section` TEXT NOT NULL; ALTER TABLE `tusuario` ADD COLUMN `data_section` TEXT NOT NULL; + +-- ----------------------------------------------------- +-- Table `treport_content_item` +-- ----------------------------------------------------- +ALTER TABLE `treport_content_item` ADD COLUMN `operation` TEXT DEFAULT ''; diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql index a995a02ef8..607416355c 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql @@ -183,3 +183,8 @@ ALTER TABLE tusuario ADD COLUMN shortcut_data CLOB default ''; ALTER TABLE tusuario ADD (section VARCHAR2(255) NOT NULL); ALTER TABLE tusuario ADD (data_section VARCHAR2(255) NOT NULL); + +-- ----------------------------------------------------- +-- Table `treport_content_item` +-- ----------------------------------------------------- +ALTER TABLE `treport_content_item` ADD (operation` CLOB default ''); diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql index ed90731e0e..52be1f8d12 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql @@ -170,3 +170,9 @@ ALTER TABLE "tusuario" ADD COLUMN "shortcut_data" text default ''; ALTER TABLE "tusuario" ADD COLUMN "section" varchar(255) NOT NULL; ALTER TABLE "tusuario" ADD COLUMN "data_section" varchar(255) NOT NULL; + +-- ----------------------------------------------------- +-- Table `treport_content_item` +-- ----------------------------------------------------- +ALTER TABLE "treport_content_item" ADD COLUMN "operation" text default ''; + diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index f6affac07e..6f59eb6831 100644 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -754,12 +754,14 @@ function print_SLA_list($width, $action, $idItem = null) { function print_General_list($width, $action, $idItem = null) { global $config; + include_once('include/functions_html.php'); ?> + @@ -797,6 +799,7 @@ function print_General_list($width, $action, $idItem = null) { echo ' + @@ -812,6 +815,7 @@ function print_General_list($width, $action, $idItem = null) { + @@ -822,6 +826,8 @@ function print_General_list($width, $action, $idItem = null) {  Type at least two characters to search + 'avg','max'=>'max','min'=>'min','sum'=>'sum'); ?> + @@ -841,7 +847,8 @@ function print_General_list($width, $action, $idItem = null) { $(document).ready (function () { agent_module_autocomplete('#text-agent', '#hidden-id_agent', '#id_agent_module', '#hidden-server_name'); agent_module_autocomplete('#text-agent_sla', '#hidden-id_agent_sla', '#id_agent_module_sla', '#hidden-server_name'); - agent_module_autocomplete('#text-agent_general', '#hidden-id_agent_general', '#id_agent_module_general', '#hidden-server_name_general'); + agent_module_autocomplete('#text-agent_general', '#hidden-id_agent_general', '#id_agent_module_general', '#hidden-server_name_general', '#id_operation_module_general'); + chooseType(); chooseSQLquery(); @@ -1050,7 +1057,9 @@ function addGeneralRow() { var idAgent = $("input[name=id_agent_general]").val(); var serverName = $("input[name=server_name_general]").val(); var idModule = $("#id_agent_module_general").val(); + var operation = $("#id_operation_module_general").val(); var nameModule = $("#id_agent_module_general :selected").text(); + var nameOperation = $("#id_operation_module_general :selected").text(); if (idAgent != '') { //Truncate nameAgent @@ -1083,11 +1092,27 @@ function addGeneralRow() { nameModule = data; } }); + //Truncate nameOperation + var params = []; + params.push("truncate_text=1"); + params.push("text=" + nameOperation); + params.push("page=include/ajax/reporting.ajax"); + jQuery.ajax ({ + data: params.join ("&"), + type: 'POST', + url: action="ajax.php", + async: false, + timeout: 10000, + success: function (data) { + nameOperation = data; + } + }); var params = []; params.push("add_general=1"); params.push("id=" + $("input[name=id_item]").val()); params.push("id_module=" + idModule); params.push("server_name_general=" + serverName); + params.push("operation=" + operation); params.push("page=include/ajax/reporting.ajax"); jQuery.ajax ({ @@ -1104,6 +1129,7 @@ function addGeneralRow() { $("#row", row).attr('id', 'general_' + data['id']); $(".agent_name", row).html(nameAgent); $(".module_name", row).html(nameModule); + $(".operation_name", row).html(nameOperation); $(".delete_button", row).attr('href', 'javascript: deleteGeneralRow(' + data['id'] + ');'); $("#list_general").append($(row).html()); @@ -1117,6 +1143,14 @@ function addGeneralRow() { $("") .attr ("value", 0) .html ($("#module_general_text").html())); + + $("#id_operation_module_general").empty(); + $("#id_operation_module_general").attr('disabled', 'true'); + $("#id_operation_module_general").append( + $("") + .attr ("value", 0) + //.html ($("#id_operation_general_text").html())); + .html ($("#operation_general_text").html())); } } }); diff --git a/pandora_console/images/avg.png b/pandora_console/images/avg.png new file mode 100644 index 0000000000000000000000000000000000000000..37356c56bef2f98fa300739fd65c7511c9983381 GIT binary patch literal 382 zcmeAS@N?(olHy`uVBq!ia0vp^f*{Pn1SGfcUswyI7>k44ofy`glX(f`a29w(7Bet# z3xhBt!>lbCYGe8D3oWG zWGJ|M`UZqI@`(c#z4ml*4AD5hH%M_^tAW6s@1Iq;E;4^%$xz`FNq@k@+UnwXNKlJY z>Y`MWOKy|9!ojaxe;0W+w&~v!&%g4fZ24Tj-Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RX0~QVp0@L3IO#lD_-$_J4R5;7! zlwC+uaTvzmbDaC|D?d>qli5(v38`smPBXKF%vnm97?LTOX&6>wT|{I^Wk!%GMXM-8 zGfNDtlqsgN{G4en^LtL`awc<`J7;I-{JYRpf}jiU`dz*6&2#ZQ@B3f~A=prG*l7N1 zMS4L|b0Z_AP;Ouh6ViKUlP@+cFvN7LBtJQ+u-59^!K+J zVWMN#Y6gES_7)rr73V$c))KRC(jyWdj~fvphsqLTuYA-q2+?zOrz7I-CAshg37EUTVRTkkn=fqw--QW=EotB&A??|h zFGgsM0T@QxM$J5f+&C+~VQhPjk+U}~-p3kW^O2hAQIOk20v@2nk@jznLEg4FP%~YF zv}cGr7pQ4jhi>yuJ`Vtl>h7=PmLNV401&B?mX^p^HlWk!>GjDlx-T7buDiW$a3IE7 zhS|aZS94%=iY~2_-&PKxk$-4Y!zNoUMkwp=7F2311p+HwZ|$S&XY$&-(@#bUIP=3= zYDJL+0I)RDI%(s--H8RpaoH!rBa_bsFidtTNwxH0vDU}m0s+-klAmR1>ATCB3u8T! z+fO|fn_6wMpNBcHN1ZKyc2DXVe;&S~NKW-H2@gf{IbfRVn{bXk>}!Pq0GQhe_CzOS zh=uHdNtX&EKjhT;1oxgisqkp#h4c`rTC*ewalirDx!a@KzG*VfnFj!{92ok|+Vto0 zcgUgp38Aa$FDHYoUOcw`{IP%g5;k9)9I*6G(x@>3t;IH`%@8rwQd!}00000NkvXXu0mjf-6?aI literal 0 HcmV?d00001 diff --git a/pandora_console/images/min.png b/pandora_console/images/min.png new file mode 100644 index 0000000000000000000000000000000000000000..789950c65665eae19aee8649bfecca63fc065c26 GIT binary patch literal 778 zcmV+l1NHogP)Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RX0~QVm5M2?1KmY&&oJmAMR5;7M zl3hqs0T_nAbKKcxY0kE}47cSEW<$f~rfF&av=E6*2}FyuXbJv=5EzLBkx3v#byMU; zLFn)SbC4w=yl=&hea`(}mGR1rbWm)%WqjbMf*b9LK@3L188M z?-q`nd{$fCNYKl&FwXXd=0U5&%l;N2|IjW+x*gQoh!EbgEPw6AKZifA)gP-d`&i#( z+x61?voGdY($Q64nV(nF?*m|FObykA#djuX0A|M0bV+~m>LAHc&d!?^xj8%l_Uk}n zeN#tE+mN`x`LM3Z(A{BX_9WfE@MOr2n{Dz6na_0h#-rD*FQ+t_l7;>U_geZ|pW|UA zpP$w>4!VbXro|`#8nh{=v@}bBB8;2S=qroVA%Ktp+LFsv*-9*8d!i&*b)@W6hD;ch z7PVTGn5#dYAw{?u3!yxEu56!Fs7OZv0Og^St=GP4NBNn98v|!Y-cza*6?tlj-`?jE zX|(GwOvsxb?RH7DaUm!GP=wJDnt8seKr3a5UWX`Iv(yXiGT~HodQ2d2^H#&OBv~aw zfp!^3{IO|DApm%-udIBPIvfK4+G)h;=v1WufS$JC{0T1#-M| zj31vAjsZK18$Hr33IX|XY;5?=0I5h(3jA}#_=M@LXMI|15CZJCQG+{7vq8WE0PtG7 zh&Ad&DGwGWx-Dc>aikEyNA%h#XWOkh&t~0T+U%jfwBNpB5o`C$y6mCq1aSa>&t@3+ zPBmYaAxerLn z;R8xO0Ik44ofy`glX(f`a29w(7Bet# z3xhBt!>lpWc?Lp07O|M~ylp1HH3v$4d$pz5E^ zoU9WaTvM|3{<~cNBG39~&whi5Il7u^33h?`~H8EWvUb4+J2vZnZ$yltoc9gozJL} dXpfX)W!P(yr{!HORReT6gQu&X%Q~loCIBr9b%Fo@ literal 0 HcmV?d00001 diff --git a/pandora_console/include/ajax/reporting.ajax.php b/pandora_console/include/ajax/reporting.ajax.php index 48ec6bbb48..76a342801a 100644 --- a/pandora_console/include/ajax/reporting.ajax.php +++ b/pandora_console/include/ajax/reporting.ajax.php @@ -88,11 +88,13 @@ if ($add_sla) { if ($add_general) { $id_module = get_parameter('id_module', 0); $server_name = get_parameter('server_name_general', ''); + $operation = get_parameter('operation', ''); $result = db_process_sql_insert('treport_content_item', array( 'id_report_content' => $id, 'id_agent_module' => $id_module, - 'server_name' => $server_name)); + 'server_name' => $server_name, + 'operation' => $operation)); if ($result === false) { $data['correct'] = 0; diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 2734137b59..0bea19f2bf 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -297,7 +297,7 @@ function reporting_get_agentmodule_data_min ($id_agent_module, $period, $date = * @return float The sumatory of the module values in the interval. */ function reporting_get_agentmodule_data_sum ($id_agent_module, $period, $date = 0) { - + global $config; // Initialize variables if (empty ($date)) $date = get_system_time (); if ((empty ($period)) OR ($period == 0)) $period = $config["sla_period"]; @@ -3265,7 +3265,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f switch ($group_by_agent) { //0 means not group by agent case 0: - $sql = sprintf("select id_agent_module, server_name from treport_content_item + $sql = sprintf("select id_agent_module, server_name, operation from treport_content_item where id_report_content = %d", $content['id_rc']); $generals = db_process_sql ($sql); @@ -3282,12 +3282,15 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $table1->head = array (); $table1->head[0] = __('Agent'); $table1->head[1] = __('Module'); - $table1->head[2] = __('Value'); + $table1->head[2] = __('Operation'); + $table1->head[3] = __('Value'); $table1->style[0] = 'text-align: left'; $table1->style[1] = 'text-align: left'; - $table1->style[2] = 'text-align: right'; + $table1->style[2] = 'text-align: left'; + $table1->style[3] = 'text-align: center'; - $data_avg = array(); + $data_res = array(); + foreach ($generals as $key => $row) { //Metaconsole connection $server_name = $row ['server_name']; @@ -3301,13 +3304,29 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $mod_name = modules_get_agentmodule_name ($row['id_agent_module']); $ag_name = modules_get_agentmodule_agent_name ($row['id_agent_module']); + + switch ($row['operation']) { + case 'sum': + $data_res[$key] = reporting_get_agentmodule_data_sum ($row['id_agent_module'], $content['period'], $report["datetime"]); + break; + case 'max': + $data_res[$key] = reporting_get_agentmodule_data_max ($row['id_agent_module'], $content['period']); + break; + case 'min': + $data_res[$key] = reporting_get_agentmodule_data_min ($row['id_agent_module'], $content['period']); + break; + case 'avg': + default: + $data_res[$key] = reporting_get_agentmodule_data_average ($row['id_agent_module'], $content['period']); + break; + } + $unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $row ['id_agent_module']); - - $data_avg[$key] = reporting_get_agentmodule_data_average ($row['id_agent_module'], $content['period']); $id_agent_module[$key] = $row['id_agent_module']; $agent_name[$key] = $ag_name; $module_name[$key] = $mod_name; $units[$key] = $unit; + $operations[$key] = $row['operation']; //Restore dbconnection if (($config ['metaconsole'] == 1) && $server_name != '') { @@ -3319,24 +3338,43 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f switch ($order_uptodown) { //Descending case 1: - array_multisort($data_avg, SORT_DESC, $agent_name, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC); + array_multisort($data_res, SORT_DESC, $agent_name, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC); break; //Ascending case 2: - array_multisort($data_avg, SORT_ASC, $agent_name, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC); + array_multisort($data_res, SORT_ASC, $agent_name, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC); break; } $i=0; - foreach ($data_avg as $d) { + foreach ($data_res as $d) { $data = array(); $data[0] = $agent_name[$i]; $data[1] = $module_name[$i]; + + switch ($operations[$i]) { + case 'sum': + $op = __('Summatory'); + break; + case 'min': + $op = __('Minimal'); + break; + case 'max': + $op = __('Maximun'); + break; + case 'avg': + default: + $op = __('Average'); + break; + } + $data[2] = $op; + if ($d === false) { - $data[2] = '--'; + $data[3] = '--'; } else { - $data[2] = format_for_graph($d, 2) . " " . $units[$i]; + $data[3] = format_for_graph($d, 2) . " " . $units[$i]; } + array_push ($table1->data, $data); $i++; } @@ -3349,11 +3387,11 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $data = array(); $data[0] = $agent_name[$i]; $data[1] = $module_name[$i]; - if ($data_avg[$i] === false) { + if ($data_res[$i] === false) { $data[2] = '--'; } else { - $data[2] = format_for_graph($data_avg[$i], 2) . " " . $units[$i]; + $data[2] = format_for_graph($data_res[$i], 2) . " " . $units[$i]; } array_push ($table1->data, $data); $i++; @@ -3368,7 +3406,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f //1 means group by agent case 1: //Get the data - $sql_data = sprintf("select id_agent_module, server_name from treport_content_item + $sql_data = sprintf("select id_agent_module, server_name, operation from treport_content_item where id_report_content = %d", $content['id_rc']); $generals = db_process_sql ($sql_data); @@ -3382,8 +3420,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $agent_list = array(); $modules_list = array(); - foreach ($generals as $general) { - + $operation_list = array(); + foreach ($generals as $general) { //Metaconsole connection $server_name = $general ['server_name']; if (($config ['metaconsole'] == 1) && $server_name != '') { @@ -3393,7 +3431,6 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f continue; } } - $ag_name = modules_get_agentmodule_agent_name ($general ['id_agent_module']); if (!in_array ($ag_name, $agent_list)) { array_push ($agent_list, $ag_name); @@ -3402,7 +3439,9 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f if (!in_array ($mod_name, $modules_list)) { array_push ($modules_list, $mod_name); } - + if (!in_array ($general['operation'], $operation_list)) { + array_push ($operation_list, $general['operation']); + } //Restore dbconnection if (($config ['metaconsole'] == 1) && $server_name != '') { metaconsole_restore_db(); @@ -3413,21 +3452,21 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $table2->data = array (); $table2->head = array (); $table2->head[0] = __('Agent'); - $table2->style[0] = 'text-align: center'; + $table2->style[0] = 'text-align: left'; $i = 1; + $x = 0; foreach ($modules_list as $m) { - $table2->head[$i] = ui_print_truncate_text($m, 20, false); + $table2->head[$i] = ui_print_truncate_text($m, 20, false).' ('.$operation_list[$x].')'; $table2->style[$i] = 'text-align: center'; $i++; + $x++; } - foreach ($agent_list as $a) { $data = array(); $data[0] = $a; $i = 1; foreach ($modules_list as $m) { foreach ($generals as $g) { - //Metaconsole connection $server_name = $g ['server_name']; if (($config ['metaconsole'] == 1) && $server_name != '') { @@ -3437,18 +3476,31 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f continue; } } - $agent_name = modules_get_agentmodule_agent_name ($g['id_agent_module']); $module_name = modules_get_agentmodule_name ($g['id_agent_module']); $unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $g['id_agent_module']); $found = false; if (strcmp($a, $agent_name) == 0 && strcmp($m, $module_name) == 0) { - $value_avg = reporting_get_agentmodule_data_average($g['id_agent_module'], $content['period']); + switch ($g['operation']) { + case 'sum': + $value_res = reporting_get_agentmodule_data_sum ($g['id_agent_module'], $content['period'], $report["datetime"]); + break; + case 'max': + $value_res = reporting_get_agentmodule_data_max ($g['id_agent_module'], $content['period']); + break; + case 'min': + $value_res = reporting_get_agentmodule_data_min ($g['id_agent_module'], $content['period']); + break; + case 'avg': + default: + $value_res = reporting_get_agentmodule_data_average ($g['id_agent_module'], $content['period']); + break; + } - if ($value_avg === false) { + if ($value_res === false) { $data[$i] = '--'; } else { - $data[$i] = format_for_graph($value_avg, 2) . " " . $unit; + $data[$i] = format_for_graph($value_res, 2) . " " . $unit; } $found = true; } @@ -3488,8 +3540,21 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f continue; } } - - $min = reporting_get_agentmodule_data_average($generals[$i]['id_agent_module'], $content['period']); + switch ($generals[$i]['operation']) { + case 'sum': + $min = reporting_get_agentmodule_data_sum ($generals[$i]['id_agent_module'], $content['period'], $report["datetime"]); + break; + case 'max': + $min = reporting_get_agentmodule_data_max ($generals[$i]['id_agent_module'], $content['period']); + break; + case 'min': + $min = reporting_get_agentmodule_data_min ($generals[$i]['id_agent_module'], $content['period']); + break; + case 'avg': + default: + $min = reporting_get_agentmodule_data_average ($generals[$i]['id_agent_module'], $content['period']); + break; + } $i++; //Restore dbconnection @@ -3515,8 +3580,22 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f continue; } } - - $value = reporting_get_agentmodule_data_average ($g['id_agent_module'], $content['period']); + switch ($g['operation']) { + case 'sum': + $value = reporting_get_agentmodule_data_sum ($g['id_agent_module'], $content['period'], $report["datetime"]); + break; + case 'max': + $value = reporting_get_agentmodule_data_max ($g['id_agent_module'], $content['period']); + break; + case 'min': + $value = reporting_get_agentmodule_data_min ($g['id_agent_module'], $content['period']); + break; + case 'avg': + default: + $value = reporting_get_agentmodule_data_average ($g['id_agent_module'], $content['period']); + break; + } + if ($value !== false) { if ($value > $max) { $max = $value; @@ -3540,7 +3619,6 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $avg = $avg / $length; } - unset($table_summary); $table_summary->width = '99%'; diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index 0cf0b17555..aed6aec2bd 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -480,6 +480,8 @@ function agent_module_autocomplete (id_agent_name, id_agent_id, id_agent_module_ }); $(id_agent_module_selector).fadeIn ('normal'); $(id_agent_module_selector).removeAttr('disabled'); + //enable operation select box + $(noneValue).removeAttr('disabled'); } }); }); diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index c65396d2c0..401fba88d6 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -1022,7 +1022,8 @@ CREATE TABLE treport_content_item ( id NUMBER(10, 0) NOT NULL PRIMARY KEY, id_report_content NUMBER(10, 0) NOT NULL REFERENCES treport_content(id_rc) ON DELETE CASCADE, id_agent_module NUMBER(10, 0) NOT NULL, - server_name CLOB default '' + server_name CLOB default '', + operation CLOB default '' ); CREATE SEQUENCE treport_content_item_s INCREMENT BY 1 START WITH 1; diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index 02676785bc..f1148ab439 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -815,7 +815,8 @@ CREATE TABLE "treport_content_item" ( "id" SERIAL NOT NULL PRIMARY KEY, "id_report_content" INTEGER NOT NULL REFERENCES treport_content("id_rc") ON UPDATE CASCADE ON DELETE CASCADE, "id_agent_module" INTEGER NOT NULL, - "server_name" TEXT DEFAULT '' + "server_name" TEXT DEFAULT '', + "operation" TEXT DEFAULT '' ); CREATE TABLE "treport_custom_sql" ( diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 3f05e9acfd..1e623fdc03 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -904,6 +904,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_item` ( `id_report_content` INTEGER UNSIGNED NOT NULL, `id_agent_module` int(10) unsigned NOT NULL, `server_name` text default '', + `operation` text default '', PRIMARY KEY(`id`), FOREIGN KEY (`id_report_content`) REFERENCES treport_content(`id_rc`) ON UPDATE CASCADE ON DELETE CASCADE
' . printSmallFont($nameAgent) . ' ' . printSmallFont($nameModule) . '' . printSmallFont($item['operation']) . ' ' . html_print_image("images/cross.png", true) . '