diff --git a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql index a5784f65d9..2adcedae80 100644 --- a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql @@ -163,3 +163,9 @@ DROP TABLE `tgis_map_has_tgis_map_connection`; ALTER TABLE `tmodule_relationship` --ADD COLUMN `id_rt` int(10) unsigned NOT NULL DEFAULT 0, ADD FOREIGN KEY (`id_rt`) REFERENCES trecon_task(`id_rt`) ON DELETE CASCADE; + +-- --------------------------------------------------------------------- +-- Table `tevent_filter` +-- --------------------------------------------------------------------- +ALTER TABLE tevent_filter ADD COLUMN `id_agent_module` int(25) DEFAULT 0; +ALTER TABLE tevent_filter ADD COLUMN `id_agent` int(25) DEFAULT 0; diff --git a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.oracle.sql b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.oracle.sql index 6c76e9dfa3..a8174cdf7c 100755 --- a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.oracle.sql @@ -117,4 +117,10 @@ WHERE id_recon_script = 2 AND name = 'IPMI Recon'; UPDATE tnetwork_component SET snmp_oid ='SELECT DNSHostName FROM Win32_ComputerSystem' WHERE id_nc = 204 AND name = 'Hostname'; UPDATE `tnetwork_component` set `tcp_port`=0 WHERE id_nc=207; -UPDATE `tnetwork_component` set `tcp_port`=0 WHERE id_nc=219; \ No newline at end of file +UPDATE `tnetwork_component` set `tcp_port`=0 WHERE id_nc=219; + +-- --------------------------------------------------------------------- +-- Table `tevent_filter` +-- --------------------------------------------------------------------- +ALTER TABLE tevent_filter ADD COLUMN id_agent_module int(25) DEFAULT 0; +ALTER TABLE tevent_filter ADD COLUMN id_agent int(25) DEFAULT 0; \ No newline at end of file diff --git a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.postgreSQL.sql index 5a0bc7de3a..4ab683b2bc 100755 --- a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.postgreSQL.sql @@ -114,4 +114,10 @@ WHERE "id_recon_script" = 2 AND "name" = 'IPMI Recon'; UPDATE tnetwork_component SET snmp_oid ='SELECT DNSHostName FROM Win32_ComputerSystem' WHERE id_nc = 204 AND name = 'Hostname'; UPDATE `tnetwork_component` set `tcp_port`=0 WHERE id_nc=207; -UPDATE `tnetwork_component` set `tcp_port`=0 WHERE id_nc=219; \ No newline at end of file +UPDATE `tnetwork_component` set `tcp_port`=0 WHERE id_nc=219; + +-- --------------------------------------------------------------------- +-- Table `tnetwork_component` +-- --------------------------------------------------------------------- +ALTER TABLE tevent_filter ADD COLUMN id_agent_module int(25) DEFAULT 0; +ALTER TABLE tevent_filter ADD COLUMN id_agent int(25) DEFAULT 0; \ No newline at end of file diff --git a/pandora_console/godmode/events/event_edit_filter.php b/pandora_console/godmode/events/event_edit_filter.php index ac95959135..68b13c5dce 100644 --- a/pandora_console/godmode/events/event_edit_filter.php +++ b/pandora_console/godmode/events/event_edit_filter.php @@ -52,6 +52,8 @@ if ($id) { $status = $filter['status']; $search = $filter['search']; $text_agent = $filter['text_agent']; + $id_agent = $filter['id_agent']; + $id_agent_module = $filter['id_agent_module']; $pagination = $filter['pagination']; $event_view_hr = $filter['event_view_hr']; $id_user_ack = $filter['id_user_ack']; @@ -66,6 +68,19 @@ if ($id) { $tag_without_base64 = base64_encode($tag_without_json_clean) ; $filter_only_alert = $filter['filter_only_alert']; + + if ($id_agent_module != 0) { + $text_module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id_agent_module); + if ($text_module == false) { + $text_module = ''; + } + } + if ($id_agent != 0) { + $text_agent = db_get_value('nombre', 'tagente', 'id_agente', $id_agent); + if ($text_agent == false) { + $text_agent = ''; + } + } } else { $id_group = ''; @@ -96,6 +111,8 @@ if($update || $create) { $status = get_parameter('status', ''); $search = get_parameter('search', ''); $text_agent = get_parameter('text_agent', ''); + $id_agent_module = get_parameter('module_search_hidden', ''); + $id_agent = get_parameter('id_agent', ''); $pagination = get_parameter('pagination', ''); $event_view_hr = get_parameter('event_view_hr', ''); $id_user_ack = get_parameter('id_user_ack', ''); @@ -118,6 +135,8 @@ if($update || $create) { 'status' => $status, 'search' => $search, 'text_agent' => $text_agent, + 'id_agent_module' => $id_agent_module, + 'id_agent' => $id_agent, 'pagination' => $pagination, 'event_view_hr' => $event_view_hr, 'id_user_ack' => $id_user_ack, @@ -220,17 +239,19 @@ $table->data[6][1] = html_print_input_text( $table->data[7][0] = '' . __('Agent search') . ''; $params = array(); -$params['return'] = true; $params['show_helptip'] = true; $params['input_name'] = 'text_agent'; $params['value'] = $text_agent; -$params['selectbox_group'] = 'id_group'; +$params['return'] = true; if (defined('METACONSOLE')) { $params['javascript_page'] = 'enterprise/meta/include/ajax/events.ajax'; } - -ui_print_agent_autocomplete_input($params); +else { + $params['print_hidden_input_idagent'] = true; + $params['hidden_input_idagent_name'] = 'id_agent'; + $params['hidden_input_idagent_value'] = $id_agent; +} $table->data[7][1] = ui_print_agent_autocomplete_input($params); @@ -345,6 +366,13 @@ $table->data[19][1] = html_print_select( '1' => __('Only alert events')), "filter_only_alert", $filter_only_alert, '', '', '', true); +if (!$meta) { + echo $id_agent_module; + $table->data[20][0] = '' . __('Module search') . ''; + $table->data[20][1] .= html_print_autocomplete_modules('module_search', + $text_module, false, $id_agent_module, true, '', array(), true); +} + echo '
'; html_print_table ($table); diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index dc0dbcb61f..54586d884f 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -2046,7 +2046,7 @@ function html_html2rgb($htmlcolor) * @return mixed If the $return is true, return the output as string. */ function html_print_autocomplete_modules($name = 'module', - $default = '', $id_agents = false, $ACL = true, $scriptResult = '', + $default = '', $id_agents = false, $id_agent_module = 0, $ACL = true, $scriptResult = '', $filter = array(), $return = false) { global $config; @@ -2103,7 +2103,7 @@ function html_print_autocomplete_modules($name = 'module', html_print_input_text_extended ($name, $default, 'text-' . $name, '', 30, 100, false, '', array('style' => 'background: url(images/input_module.png) no-repeat right;')); - html_print_input_hidden($name . "_hidden", 0); + html_print_input_hidden($name . "_hidden", $id_agent_module); ui_print_help_tip(__('Type at least two characters to search the module.'), false); $javascript_ajax_page = diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 4c7d5d2f48..9251587f03 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -237,7 +237,7 @@ if ($id_agent != 0) { $text_module = (string) get_parameter('module_search', ''); -$id_agent_module = get_parameter('id_agent_module', 0); +$id_agent_module = get_parameter('module_search_hidden', 0); if ($id_agent_module != 0) { $text_module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id_agent_module); if ($text_module == false) { @@ -277,6 +277,7 @@ $params = "search=" . rawurlencode(io_safe_input($search)) . "&recursion=" . $recursion . "&refr=" . (int)get_parameter("refr", 0) . "&id_agent=" . $id_agent . + "&id_agent_module=" . $id_agent_module . "&pagination=" . $pagination . "&group_rep=" . $group_rep . "&event_view_hr=" . $event_view_hr . diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php index a8baa561f4..c71cb158b8 100644 --- a/pandora_console/operation/events/events_list.php +++ b/pandora_console/operation/events/events_list.php @@ -67,6 +67,8 @@ if (is_ajax()) { $values['status'] = get_parameter('status'); $values['search'] = get_parameter('search'); $values['text_agent'] = get_parameter('text_agent'); + $values['id_agent'] = get_parameter('id_agent'); + $values['id_agent_module'] = get_parameter('id_agent_module'); $values['pagination'] = get_parameter('pagination'); $values['event_view_hr'] = get_parameter('event_view_hr'); $values['id_user_ack'] = get_parameter('id_user_ack'); @@ -103,6 +105,8 @@ if (is_ajax()) { $values['status'] = get_parameter('status'); $values['search'] = get_parameter('search'); $values['text_agent'] = get_parameter('text_agent'); + $values['id_agent'] = get_parameter('id_agent'); + $values['id_agent_module'] = get_parameter('id_agent_module'); $values['pagination'] = get_parameter('pagination'); $values['event_view_hr'] = get_parameter('event_view_hr'); $values['id_user_ack'] = get_parameter('id_user_ack'); @@ -431,7 +435,7 @@ $data[0] .= html_print_select($user_users, "id_user_ack", $id_user_ack, '', if (!$meta) { $data[1] = __('Module search') . $jump; $data[1] .= html_print_autocomplete_modules('module_search', - $text_module, false, true, '', array(), true); + $text_module, false, $id_agent_module, true, '', array(), true); } else { $data[1] = __('Server') . $jump; @@ -869,7 +873,8 @@ $(document).ready( function() { $("#severity").val(-1); $("#status").val(3); $("#text-search").val(''); - $("#text_id_agent").val( ); + $('input:hidden[name=id_agent]').val(); + $('input:hidden[name=module_search_hidden]').val(); $("#pagination").val(25); $("#text-event_view_hr").val(8); $("#id_user_ack").val(0); @@ -910,6 +915,10 @@ $(document).ready( function() { $("#text-search").val(val); if (i == 'text_agent') $("#text_id_agent").val(val); + if (i == 'id_agent') + $('input:hidden[name=id_agent]').val(val); + if (i == 'id_agent_module') + $('input:hidden[name=module_search_hidden]').val(val); if (i == 'pagination') $("#pagination").val(val); if (i == 'event_view_hr') @@ -980,6 +989,8 @@ $(document).ready( function() { "status" : $("#status").val(), "search" : $("#text-search").val(), "text_agent" : $("#text_id_agent").val(), + "id_agent" : $('input:hidden[name=id_agent]').val(), + "id_agent_module" : $('input:hidden[name=module_search_hidden]').val(), "pagination" : $("#pagination").val(), "event_view_hr" : $("#text-event_view_hr").val(), "id_user_ack" : $("#id_user_ack").val(), @@ -1073,6 +1084,8 @@ $(document).ready( function() { "status" : $("#status").val(), "search" : $("#text-search").val(), "text_agent" : $("#text_id_agent").val(), + "id_agent" : $('input:hidden[name=id_agent]').val(), + "id_agent_module" : $('input:hidden[name=module_search_hidden]').val(), "pagination" : $("#pagination").val(), "event_view_hr" : $("#text-event_view_hr").val(), "id_user_ack" : $("#id_user_ack").val(), diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index 4b5baa13ed..38d2b24ca8 100755 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -1898,7 +1898,9 @@ CREATE TABLE tevent_filter ( severity NUMBER(10, 0) DEFAULT -1, status NUMBER(10, 0) DEFAULT -1, search CLOB DEFAULT '', - text_agent CLOB DEFAULT '', + text_agent CLOB DEFAULT '', + id_agent int(10) DEFAULT 0, + id_agent_module int(10) DEFAULT 0, pagination NUMBER(10, 0) DEFAULT 25, event_view_hr NUMBER(10, 0) DEFAULT 8, id_user_ack CLOB, diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index 269469d442..c054a648db 100755 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -1595,7 +1595,9 @@ CREATE TABLE "tevent_filter" ( "severity" INTEGER NOT NULL default -1, "status" INTEGER NOT NULL default -1, "search" TEXT default '', - "text_agent" TEXT default '', + "text_agent" TEXT default '', + "id_agent" int(10) default 0, + "id_agent_module" int(10) default 0, "pagination" INTEGER NOT NULL default 25, "event_view_hr" INTEGER NOT NULL default 8, "id_user_ack" TEXT, diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 7386fe8c66..868a66d491 100755 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1692,7 +1692,9 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` ( `severity` int(10) NOT NULL default -1, `status` int(10) NOT NULL default -1, `search` TEXT, - `text_agent` TEXT, + `text_agent` TEXT, + `id_agent` int(10) default 0, + `id_agent_module` int(10) default 0, `pagination` int(10) NOT NULL default 25, `event_view_hr` int(10) NOT NULL default 8, `id_user_ack` TEXT,