From b4305d7b9a1c4282f4663e622ee281b1cf299775 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 20 Mar 2014 16:43:42 +0000 Subject: [PATCH] 2014-03-20 Miguel de Dios * images/group_green.disabled.png, images/group_green.png, extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql, extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql, extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql, godmode/reporting/visual_console_builder.editor.js, godmode/agentes/configurar_agente.php, include/styles/pandora.css, include/functions_networkmap.php, include/functions_agents.php, include/functions_visual_map_editor.php, include/functions_modules.php, include/functions_groups.php, include/constants.php, include/functions_visual_map.php, include/ajax/visual_console_builder.ajax.php, pandoradb.sql, pandoradb.postgreSQL.sql, pandoradb.oracle.sql: added the feature to show the item for groups in visualmap. Incident: #671 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9621 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 18 +++++ .../pandoradb_migrate_5.0.x_to_5.1.mysql.sql | 9 ++- .../pandoradb_migrate_5.0.x_to_5.1.oracle.sql | 7 +- ...doradb_migrate_5.0.x_to_5.1.postgreSQL.sql | 5 ++ .../godmode/agentes/configurar_agente.php | 2 +- .../visual_console_builder.editor.js | 48 ++++++++++++- .../images/group_green.disabled.png | Bin 0 -> 328 bytes pandora_console/images/group_green.png | Bin 0 -> 324 bytes .../ajax/visual_console_builder.ajax.php | 18 +++-- pandora_console/include/constants.php | 5 +- pandora_console/include/functions_agents.php | 6 +- pandora_console/include/functions_groups.php | 31 +++------ pandora_console/include/functions_modules.php | 16 +++-- .../include/functions_networkmap.php | 2 +- .../include/functions_visual_map.php | 51 +++++++++++++- .../include/functions_visual_map_editor.php | 63 ++++++++++++------ pandora_console/include/styles/pandora.css | 7 ++ pandora_console/pandoradb.oracle.sql | 3 +- pandora_console/pandoradb.postgreSQL.sql | 3 +- pandora_console/pandoradb.sql | 1 + 20 files changed, 233 insertions(+), 62 deletions(-) create mode 100644 pandora_console/images/group_green.disabled.png create mode 100644 pandora_console/images/group_green.png diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 7587cf0aff..09131243f3 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,21 @@ +2014-03-20 Miguel de Dios + + * images/group_green.disabled.png, images/group_green.png, + extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql, + extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql, + extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql, + godmode/reporting/visual_console_builder.editor.js, + godmode/agentes/configurar_agente.php, include/styles/pandora.css, + include/functions_networkmap.php, include/functions_agents.php, + include/functions_visual_map_editor.php, + include/functions_modules.php, include/functions_groups.php, + include/constants.php, include/functions_visual_map.php, + include/ajax/visual_console_builder.ajax.php, pandoradb.sql, + pandoradb.postgreSQL.sql, pandoradb.oracle.sql: added the feature to + show the item for groups in visualmap. + + Incident: #671 + 2014-03-20 Miguel de Dios * godmode/snmpconsole/snmp_alert.php, diff --git a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql index 8ccf1c4ec1..1d524b093d 100644 --- a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql @@ -43,9 +43,9 @@ ALTER TABLE tgraph_source MODIFY COLUMN `weight` float(8,3) NOT NULL DEFAULT 0; ALTER TABLE `pandora`.`tagente_modulo` MODIFY COLUMN `post_process` DOUBLE DEFAULT NULL; /* 2014/03/18 */ --- ---------------------------------------------------------------------- +-- --------------------------------------------------------------------- -- Table `tmodule_relationship` --- ---------------------------------------------------------------------- +-- --------------------------------------------------------------------- CREATE TABLE IF NOT EXISTS `tmodule_relationship` ( `id` int(10) unsigned NOT NULL auto_increment, `module_a` int(10) unsigned NOT NULL, @@ -79,3 +79,8 @@ ALTER TABLE `talert_snmp` ADD COLUMN `_snmp_f19_` text; ALTER TABLE `talert_snmp` ADD COLUMN `_snmp_f20_` text; ALTER TABLE `tnetwork_map` ADD COLUMN `l2_network` tinyint(1) unsigned NOT NULL default '0'; + +-- --------------------------------------------------------------------- +-- Table `tlayout_data` +-- --------------------------------------------------------------------- +ALTER TABLE `tlayout_data` ADD COLUMN `id_group` INTEGER UNSIGNED NOT NULL default 0; diff --git a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql index f21919735d..04b3c7bf4d 100644 --- a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql @@ -68,4 +68,9 @@ ALTER TABLE talert_snmp ADD (_snmp_f18_ CLOB default ''); ALTER TABLE talert_snmp ADD (_snmp_f19_ CLOB default ''); ALTER TABLE talert_snmp ADD (_snmp_f20_ CLOB default ''); -ALTER TABLE tnetwork_map ADD (l2_network NUMBER(1, 0) default 0 NOT NULL); \ No newline at end of file +ALTER TABLE tnetwork_map ADD (l2_network NUMBER(1, 0) default 0 NOT NULL); + +-- --------------------------------------------------------------------- +-- Table `tlayout_data` +-- --------------------------------------------------------------------- +ALTER TABLE `tlayout_data` ADD COLUMN id_group NUMBER(10, 0) default 0 NOT NULL; diff --git a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql index 0eb475de62..4316938277 100644 --- a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql @@ -66,3 +66,8 @@ ALTER TABLE "talert_snmp" ADD COLUMN "_snmp_f19_" text DEFAULT ''; ALTER TABLE "talert_snmp" ADD COLUMN "_snmp_f20_" text DEFAULT ''; ALTER TABLE "tnetwork_map" ADD COLUMN "l2_network" SMALLINT NOT NULL default 0; + +-- --------------------------------------------------------------------- +-- Table `tlayout_data` +-- --------------------------------------------------------------------- +ALTER TABLE "tlayout_data" ADD COLUMN "id_group" INTEGER NOT NULL default 0; \ No newline at end of file diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index a997c9b62d..ae35367672 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -382,7 +382,7 @@ if ($id_agente) { 'tab=remote_configuration&' . 'id_agente=' . $id_agente . '&' . 'disk_conf=' . $agent_md5 . '">' - . html_print_image ("images/book_edit.png", true, + . html_print_image ("images/remote_configuration.png", true, array("title" =>__('Remote configuration'))) . ''; if ($tab == 'remote_configuration') diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 8000a9520f..c819b6e6d0 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -103,6 +103,7 @@ function update_button_palette_callback() { idElement = 0; break; + case 'group_item': case 'static_graph': $("#text_" + idItem).html(values['label']); @@ -219,6 +220,7 @@ function readFields() { values['type_percentile'] = $("input[name=type_percentile]:checked").val(); values['value_show'] = $("input[name=value_show]:checked").val(); values['enable_link'] = $("input[name=enable_link]").is(':checked') ? 1 : 0; + values['id_group'] = $("select[name=group]").val(); if (metaconsole != 0) { values['metaconsole'] = 1; @@ -245,6 +247,7 @@ function create_button_palette_callback() { //VALIDATE DATA var validate = true; switch (creationItem) { + case 'group_item': case 'static_graph': if ((values['label'] == '') && (values['image'] == '')) { alert($("#message_alert_no_label_no_image").html()); @@ -332,6 +335,7 @@ function toggle_item_palette() { activeToolboxButton('label', true); activeToolboxButton('icon', true); activeToolboxButton('percentile_item', true); + activeToolboxButton('group_item', true); if (typeof(enterprise_activeToolboxButton) == 'function') { enterprise_activeToolboxButton(true); @@ -355,6 +359,7 @@ function toggle_item_palette() { activeToolboxButton('label', false); activeToolboxButton('icon', false); activeToolboxButton('percentile_item', false); + activeToolboxButton('group_item', false); activeToolboxButton('edit_item', false); activeToolboxButton('delete_item', false); @@ -539,6 +544,10 @@ function loadFieldsFromDB(item) { } } + if (key == 'id_group') { + $("select[name=group]").val(val); + } + if (metaconsole != 0) { if (key == 'id_agent') { $("#hidden-agent").val(val); @@ -638,6 +647,9 @@ function hiddenFields(item) { $("#module_row").css('display', 'none'); $("#module_row." + item).css('display', ''); + $("#group_row").css('display', 'none'); + $("#group_row." + item).css('display', ''); + $("#process_value_row").css('display', 'none'); $("#process_value_row." + item).css('display', ''); @@ -1036,6 +1048,7 @@ function createItem(type, values, id_data) { } switch (type) { + case 'group_item': case 'static_graph': if ((values['width'] == 0) && (values['height'] == 0)) { sizeStyle = ''; @@ -1048,7 +1061,8 @@ function createItem(type, values, id_data) { var element_status= null; var parameter = Array(); - parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); + parameter.push ({name: "page", + value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "get_element_status", value: "1"}); parameter.push ({name: "id_element", value: id_data}); @@ -1088,8 +1102,17 @@ function createItem(type, values, id_data) { } }); + switch (type) { + case 'group_item': + class_type = "group_item"; + break; + case 'static_graph': + class_type = "static_graph"; + break; + } + item = $('
' + @@ -1264,6 +1287,7 @@ function updateDB_visual(type, idElement , values, event, top, left) { } switch (type) { + case 'group_item': case 'static_graph': if ((event != 'resizestop') && (event != 'show_grid') && (event != 'dragstop')) { @@ -1591,6 +1615,14 @@ function eventsItems(drag) { activeToolboxButton('delete_item', true); activeToolboxButton('show_grid', false); } + if ($(divParent).hasClass('group_item')) { + creationItem = null; + selectedItem = 'group_item'; + idItem = $(divParent).attr('id'); + activeToolboxButton('edit_item', true); + activeToolboxButton('delete_item', true); + activeToolboxButton('show_grid', false); + } if ($(divParent).hasClass('percentile_item')) { creationItem = null; selectedItem = 'percentile_item'; @@ -1661,6 +1693,9 @@ function eventsItems(drag) { if ($(event.target).hasClass('static_graph')) { selectedItem = 'static_graph'; } + if ($(event.target).hasClass('group_item')) { + selectedItem = 'group_item'; + } if ($(event.target).hasClass('percentile_item')) { selectedItem = 'percentile_item'; } @@ -1821,7 +1856,11 @@ function click_button_toolbox(id) { toolbuttonActive = creationItem = 'icon'; toggle_item_palette(); break; - + case 'group_item': + toolbuttonActive = creationItem = 'group_item'; + toggle_item_palette(); + break; + case 'edit_item': toggle_item_palette(); break; @@ -1848,6 +1887,7 @@ function click_button_toolbox(id) { activeToolboxButton('label', false); activeToolboxButton('icon', false); activeToolboxButton('service', false); + activeToolboxButton('group_item', false); activeToolboxButton('edit_item', false); activeToolboxButton('delete_item', false); @@ -1875,6 +1915,7 @@ function click_button_toolbox(id) { activeToolboxButton('simple_value', true); activeToolboxButton('label', true); activeToolboxButton('icon', true); + activeToolboxButton('group_item', true); } break; case 'save_visualmap': @@ -1917,6 +1958,7 @@ function showPreview(image) { metaconsole = $("input[name='metaconsole']").val(); switch (toolbuttonActive) { + case 'group_item': case 'static_graph': showPreviewStaticGraph(image); break; diff --git a/pandora_console/images/group_green.disabled.png b/pandora_console/images/group_green.disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..ab1aeb160cd8d4f741dc3bff1a347d4c87d9b97f GIT binary patch literal 328 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjY)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYYs>cdx@v7EBifW5gti38=W0#K%uLiE{-7{$KOsp%X`Rx$1T25@d1nS z2FH^sQ>3FM${BAk%vh2*c@v{gfZoawS6yEgQJGiXQ}p}d-~3Sx4K-ZiD{;f^z+=Sa(!My^Q+$MRmea2EPNs9=5h`KkVPhn!2#T>WA7QsqO1{ z)+}FZr%`!RLz$uT{lZo4ZkA5Q8%o)fiZWPNyyCLh{Z90T8`CRG25UjhXyXiqZi$AD z8T)r<^mkay-RGIX5_;D}&Qe*)Eajew!4JV3%*EbM;ju?f=?UGtM?JQ?-n| RGY{xN22WQ%mvv4FO#q7Zbw&UH literal 0 HcmV?d00001 diff --git a/pandora_console/images/group_green.png b/pandora_console/images/group_green.png new file mode 100644 index 0000000000000000000000000000000000000000..77be39179f15f7ef250821e7ebe876ff5b754f15 GIT binary patch literal 324 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjY)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYYs>cdx@v7EBifW5guW|y1K8AfkGEOT^vI^j=!CHk+;b}pv}Ig`h?oF z5`n^rY`Yoq7VupPFgwUw!c?;vV2^nGMe{(pgPd~#+q?sI2fj0Z+qyfzZt8+!J*7>7{H_Vi zI)9a(_D(-mF5e<{s^gIN@hcoT;*Ha`y-*EsTXNv2ZvFwqNeir*3$9!;+bdYn63Wv! z&FuGXw`!Lkl3RS2RRy?lfdod P&oOwq`njxgN@xNAbvAv_ literal 0 HcmV?d00001 diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index 8e0b09ad08..e90899b552 100644 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -67,6 +67,7 @@ $server_name = get_parameter('server_name', null); $server_id = (int)get_parameter('server_id', 0); $id_agent = get_parameter('id_agent', null); $id_metaconsole = get_parameter('id_metaconsole', null); +$id_group = (int)get_parameter('id_group', 0); $get_element_status = get_parameter('get_element_status', 0); $get_image_path_status = get_parameter('get_image_path_status', 0); @@ -166,9 +167,6 @@ switch ($action) { FROM tagente_estado WHERE id_agente_modulo = ' . $layoutData['id_agente_modulo']); - //html_debug_print($value_show); - //html_debug_print($layoutData); - if (($layoutData['type'] == PERCENTILE_BAR) || ($layoutData['type'] == PERCENTILE_BUBBLE)) { if ($value_show == 'value') { @@ -368,6 +366,9 @@ switch ($action) { $values['label_color'] = $label_color; } switch($type) { + case 'group_item': + $values['id_group'] = $id_group; + break; case 'module_graph': if ($height_module_graph !== null) { $values['height'] = $height_module_graph; @@ -445,6 +446,7 @@ switch ($action) { case 'percentile_bar': case 'percentile_item': case 'static_graph': + case 'group_item': case 'module_graph': case 'simple_value': case 'label': @@ -606,6 +608,13 @@ switch ($action) { $values['width'] = $width; $values['height'] = $height; break; + case 'group_item': + $values['type'] = GROUP_ITEM; + $values['image'] = $image; + $values['width'] = $width; + $values['height'] = $height; + $values['id_group'] = $id_group; + breaK; case 'simple_value': //This allows min, max and avg process in a simple value $values['type'] = visual_map_get_simple_value_type($process_simple_value); @@ -681,7 +690,8 @@ switch ($action) { /* visual map element status check */ if ($get_element_status) { - $layoutData = db_get_row_filter('tlayout_data', array('id' => $id_element)); + $layoutData = db_get_row_filter('tlayout_data', + array('id' => $id_element)); $res = visual_map_get_status_element($layoutData); diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index ee8144ff7d..6fa8e2dfbb 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -157,13 +157,14 @@ define('AGENT_MODULE_STATUS_CRITICAL_BAD', 1); define('AGENT_MODULE_STATUS_CRITICAL_ALERT', 100); define('AGENT_MODULE_STATUS_NO_DATA', 4); define('AGENT_MODULE_STATUS_NORMAL', 0); +define('AGENT_MODULE_STATUS_NORMAL_ALERT', 300); define('AGENT_MODULE_STATUS_NOT_NORMAL', 6); define('AGENT_MODULE_STATUS_WARNING', 2); define('AGENT_MODULE_STATUS_WARNING_ALERT', 200); define('AGENT_MODULE_STATUS_UNKNOWN', 3); define('AGENT_MODULE_STATUS_NOT_INIT', 5); -/* Agent module status */ +/* Agent status */ define('AGENT_STATUS_ALL', -1); define('AGENT_STATUS_CRITICAL', 1); define('AGENT_STATUS_NORMAL', 0); @@ -174,7 +175,6 @@ define('AGENT_STATUS_ALERT_FIRED', 4); define('AGENT_STATUS_WARNING', 2); - /* Visual maps contants */ //The items kind define('STATIC_GRAPH', 0); @@ -188,6 +188,7 @@ define('SIMPLE_VALUE_MIN', 7); define('SIMPLE_VALUE_AVG', 8); define('PERCENTILE_BUBBLE', 9); define('SERVICE', 10); //Enterprise Item. +define('GROUP_ITEM', 11); //Some styles define('MIN_WIDTH',300); define('MIN_HEIGHT',120); diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 1003057dda..6fc6dee4d5 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -1498,7 +1498,7 @@ function agents_get_status($id_agent = 0, $noACLs = false) { $all_modules = db_get_all_rows_filter('tagente_modulo', $filter_modules, 'id_agente_modulo'); - $result_modules = array(); + $result_modules = array(); // Skip non init modules foreach ($all_modules as $module) { if (modules_get_agentmodule_is_init($module['id_agente_modulo'])){ @@ -1560,6 +1560,10 @@ function agents_get_status($id_agent = 0, $noACLs = false) { elseif (is_int(array_search(AGENT_MODULE_STATUS_CRITICAL_BAD, $modules_status))) { return AGENT_MODULE_STATUS_CRITICAL_BAD; } + // Checking if any module has critical status + elseif (is_int(array_search(AGENT_MODULE_STATUS_NORMAL_ALERT, $modules_status))) { + return AGENT_STATUS_ALERT_FIRED; + } // Checking if any module has warning status elseif (is_int(array_search(AGENT_MODULE_STATUS_WARNING,$modules_status))) { return AGENT_MODULE_STATUS_WARNING; diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index ce06c89014..56f49331cf 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -541,32 +541,21 @@ function groups_get_status ($id_group = 0) { } // Status is 0 for normal, 1 for critical, 2 for warning and 3/-1 for unknown. 4 for fired alerts - - // Checking if any agent has fired alert (4) - if (is_int(array_search(4,$agents_status))) { - return 4; + if (is_int(array_search(AGENT_STATUS_ALERT_FIRED, $agents_status))) { + return AGENT_STATUS_ALERT_FIRED; } - // Checking if any agent has critical status (1) - elseif (is_int(array_search(1,$agents_status))) { - return 1; + elseif (is_int(array_search(AGENT_STATUS_CRITICAL, $agents_status))) { + return AGENT_STATUS_CRITICAL; } - // Checking if any agent has warning status (2) - elseif (is_int(array_search(2,$agents_status))) { - return 2; + elseif (is_int(array_search(AGENT_STATUS_WARNING, $agents_status))) { + return AGENT_STATUS_WARNING; } - // Checking if any agent has unknown status (-1) - elseif (is_int(array_search(-1,$agents_status))) { - return -1; - } - // Checking if any agents module has unknown status (3) - elseif (is_int(array_search(3,$agents_status))) { - return 3; + elseif (is_int(array_search(AGENT_STATUS_UNKNOWN, $agents_status))) { + return AGENT_STATUS_UNKNOWN; } else { - return 0; + return AGENT_STATUS_NORMAL; } - - return $status; } /** @@ -931,7 +920,7 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups) { //of this groups and its children. It was done to print empty fathers of children groups. //We need to recalculate the total agents for this group here to get only the total agents //for this group. Of course the group All (0) is a special case. - + if ($id_group != 0) { $data["total_agents"] = db_get_sql ("SELECT COUNT(id_agente) FROM tagente diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index 789ebd05c3..1fb0e71d04 100644 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -1331,8 +1331,9 @@ function modules_get_agentmodule_status($id_agentmodule = 0, $without_alerts = f $server = db_get_row('tmetaconsole_setup', 'id', $id_server); if (metaconsole_connect($server) == NOERR) { - $status_row = db_get_row ("tagente_estado", "id_agente_modulo", $id_agentmodule); - + $status_row = db_get_row ("tagente_estado", + "id_agente_modulo", $id_agentmodule); + if (!$without_alerts) { $times_fired = db_get_value ('SUM(times_fired)', 'talert_template_modules', 'id_agent_module', $id_agentmodule); if ($times_fired > 0) { @@ -1350,12 +1351,19 @@ function modules_get_agentmodule_status($id_agentmodule = 0, $without_alerts = f metaconsole_restore_db(); } else { - $status_row = db_get_row ("tagente_estado", "id_agente_modulo", $id_agentmodule); + $status_row = db_get_row ("tagente_estado", + "id_agente_modulo", $id_agentmodule); if (!$without_alerts) { - $times_fired = db_get_value ('SUM(times_fired)', 'talert_template_modules', 'id_agent_module', $id_agentmodule); + $times_fired = db_get_value ('SUM(times_fired)', + 'talert_template_modules', 'id_agent_module', $id_agentmodule); + if ($times_fired > 0) { + switch($status_row['estado']) { + case AGENT_STATUS_NORMAL: + return AGENT_MODULE_STATUS_NORMAL_ALERT; + break; case AGENT_STATUS_WARNING: return AGENT_MODULE_STATUS_WARNING_ALERT; // Alert fired in warning break; diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index 35d50bbcb4..f9bec96a9e 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -275,7 +275,7 @@ function networkmap_generate_dot ($pandora_name, $group = 0, if ($agents === false) //return false; $agents = array(); - + // Open Graph $graph = networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, $ranksep, $font_size); diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 41414cf294..9741748304 100644 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -122,6 +122,31 @@ function visual_map_print_item($layoutData) { echo "
"; break; + case GROUP_ITEM: + if ($layoutData['image'] != null) { + $img = visual_map_get_image_status_element($layoutData); + if (substr($img,0,1) == '4') { + $borderStyle ='border: 2px solid #ffa300;'; + $img = substr_replace($img, '', 0,1); + } + } + + if (($width != 0) && ($height != 0)) { + $sizeStyle = 'width: ' . $width . 'px; height: ' . $height . 'px;'; + $imageSize = 'width="' . $width . '" height="' . $height . '"'; + } + echo '
'; + if ($layoutData['image'] != null) { + if (($width != 0) && ($height != 0)) + echo html_print_image($img, true, array("class" => "image", "id" => "image_" . $id, "width" => "$width", "height" => "$height", "style" => $borderStyle)); + else + echo html_print_image($img, true, array("class" => "image", "id" => "image_" . $id, "style" => $borderStyle)); + echo '
'; + } + echo io_safe_output($text); + echo "
"; + break; + case PERCENTILE_BAR: case PERCENTILE_BUBBLE: //Metaconsole db connection @@ -868,6 +893,29 @@ function visual_map_get_status_element($layoutData) { } break; + case GROUP_ITEM: + $group_status = groups_get_status($layoutData['id_group']); + + switch ($group_status) { + case AGENT_STATUS_ALERT_FIRED: + return VISUAL_MAP_STATUS_CRITICAL_ALERT; + break; + case AGENT_STATUS_CRITICAL: + return VISUAL_MAP_STATUS_CRITICAL_BAD; + break; + case AGENT_STATUS_WARNING: + return VISUAL_MAP_STATUS_WARNING; + break; + case AGENT_STATUS_UNKNOWN: + return VISUAL_MAP_STATUS_UNKNOWN; + break; + case AGENT_STATUS_NORMAL: + default: + return VISUAL_MAP_STATUS_NORMAL; + break; + } + break; + default: //If it's a graph, a progress bar or a data tag, ALWAYS report status OK //(=0) to avoid confussions here. @@ -884,7 +932,7 @@ function visual_map_get_status_element($layoutData) { case AGENT_MODULE_STATUS_WARNING_ALERT: $status = VISUAL_MAP_STATUS_WARNING_ALERT; break; - } + } return $status; } @@ -1066,6 +1114,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line } switch ($layout_data['type']) { + case GROUP_ITEM: case STATIC_GRAPH: if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD) $z_index = 3; diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index 54c3b5a7ff..a61229e1b3 100644 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -75,47 +75,56 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { ' . __('Label') .' - '. html_print_input_text ('label', '', '', 20, 200, true) .''; - */ $form_items['label_row'] = array(); - $form_items['label_row']['items'] = array('label', 'static_graph', - 'percentile_bar', 'percentile_item', 'module_graph', - 'simple_value', 'datos', 'icon'); + $form_items['label_row']['items'] = array('label', + 'static_graph', + 'percentile_bar', + 'percentile_item', + 'module_graph', + 'simple_value', + 'datos', + 'icon', + 'group_item'); $form_items['label_row']['html'] = '' . __('Label') .' '. html_print_input_text ('label', '', '', 20, 200, true) .''; $form_items['image_row'] = array(); - $form_items['image_row']['items'] = array('static_graph', 'icon', 'datos'); + $form_items['image_row']['items'] = array('static_graph', + 'icon', + 'datos', + 'group_item'); $form_items['image_row']['html'] = '' . __('Image') . ' '. html_print_select ($images_list, 'image', '', 'showPreview(this.value);', 'None', '', true) .''; $form_items['enable_link_row'] = array(); - $form_items['enable_link_row']['items'] = array('static_graph', - 'percentile_bar', 'percentile_item', 'module_graph', - 'simple_value', 'datos', 'icon'); + $form_items['enable_link_row']['items'] = array( + 'static_graph', + 'percentile_bar', + 'percentile_item', + 'module_graph', + 'simple_value', + 'datos', + 'icon', + 'group_item'); $form_items['enable_link_row']['html'] = '' . __('Enable link') .' '. html_print_checkbox('enable_link', '', 'enable_link', true) .''; $form_items['preview_row'] = array(); - $form_items['preview_row']['items'] = array('static_graph', 'datos icon'); + $form_items['preview_row']['items'] = array('static_graph', + 'datos icon', + 'group_item'); $form_items['preview_row']['html'] = '
'; + $form_items['agent_row'] = array(); $form_items['agent_row']['items'] = array('static_graph', 'percentile_bar', 'percentile_item', 'module_graph', 'simple_value', 'datos'); $form_items['agent_row']['html'] = '' . __('Agent') . ''; - - - $params = array(); $params['return'] = true; $params['show_helptip'] = true; @@ -143,13 +152,28 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { ''; - $form_items['module_row'] = array(); $form_items['module_row']['items'] = array('static_graph', 'percentile_bar', 'percentile_item', 'module_graph', 'simple_value', 'datos'); $form_items['module_row']['html'] = '' . __('Module') . ' - '. html_print_select (array(), 'module', '', '', __('Any'), 0, true) . ''; + ' . html_print_select (array(), 'module', '', '', __('Any'), 0, true) . ''; + + $own_info = get_user_info($config['id_user']); + if (!$own_info['is_admin'] && !check_acl ($config['id_user'], 0, "PM")) + $return_all_group = false; + else + $return_all_group = true; + $form_items['group_row'] = array(); + $form_items['group_row']['items'] = array('group_item'); + $form_items['group_row']['html'] = '' . + __('Group') . + ' + ' . + html_print_select_groups(false, "AR", + $return_all_group, 'group', '', '', '', 0, + true) . + ''; $form_items['process_value_row'] = array(); @@ -359,6 +383,7 @@ function visual_map_editor_print_toolbox() { visual_map_print_button_editor('simple_value', __('Simple Value'), 'left', false, 'binary_min', true); visual_map_print_button_editor('label', __('Label'), 'left', false, 'label_min', true); visual_map_print_button_editor('icon', __('Icon'), 'left', false, 'icon_min', true); + visual_map_print_button_editor('group_item', __('Group'), 'left', false, 'group_item_min', true); enterprise_hook("enterprise_visual_map_editor_print_toolbox"); diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index c4bda51b4a..ed17f02968 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -1001,6 +1001,13 @@ input.service_min[disabled] { background: #fefefe url(../../images/box.disabled.png) no-repeat center !important; } +input.group_item_min { + background: #fefefe url(../../images/group_green.png) no-repeat center !important; +} +input.group_item_min[disabled] { + background: #fefefe url(../../images/group_green.disabled.png) no-repeat center !important; +} + div#cont { position: fixed; max-height: 320px; diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index bcb96fdb7d..0a1d970649 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -1211,7 +1211,8 @@ CREATE TABLE tlayout_data ( label_color varchar(20) DEFAULT '', no_link_color NUMBER(5, 0) default 0 NOT NULL, enable_link NUMBER(5, 0) default 1 NOT NULL, - id_metaconsole NUMBER(10, 0) default 0 NOT NULL + id_metaconsole NUMBER(10, 0) default 0 NOT NULL, + id_group NUMBER(10, 0) default 0 NOT NULL ); CREATE SEQUENCE tlayout_data_s INCREMENT BY 1 START WITH 1; CREATE OR REPLACE TRIGGER tlayout_data_inc BEFORE INSERT ON tlayout_data REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tlayout_data_s.nextval INTO :NEW.ID FROM dual; END tlayout_data_inc;; diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index 1a726641c3..19f8a8f8f1 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -1062,7 +1062,8 @@ CREATE TABLE "tlayout_data" ( "label_color" varchar(20) DEFAULT '', "no_link_color" SMALLINT NOT NULL default 0, "enable_link" SMALLINT NOT NULL default 1, - "id_metaconsole" INTEGER NOT NULL default 0 + "id_metaconsole" INTEGER NOT NULL default 0, + "id_group" INTEGER NOT NULL default 0 ); -- --------------------------------------------------------------------- diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 6d3268ec93..99414c9671 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1151,6 +1151,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_data` ( `no_link_color` tinyint(1) UNSIGNED NOT NULL default 0, `enable_link` tinyint(1) UNSIGNED NOT NULL default 1, `id_metaconsole` int(10) NOT NULL default 0, + `id_group` INTEGER UNSIGNED NOT NULL default 0, PRIMARY KEY(`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8;