From 75d27409ff37ec9956023425525c10c37e908373 Mon Sep 17 00:00:00 2001 From: juanmanuelr <noreply@pandorafms.org> Date: Thu, 9 Feb 2012 11:20:28 +0000 Subject: [PATCH] 2012-02-09 Juan Manuel Ramon <juanmanuel.ramon@artica.es> * include/help/en/help_snmp_alert_configuration.php include/help/es/help_snmp_alert_configuration.php include/help/en/help_snmp_alert_filters.php include/help/es/help_snmp_alert_filters.php include/help/es/help_field_match_snmp.php include/help/en/help_field_match_snmp.php: Added helps for snmp alert editor. * include/help/en/help_snmp_alert_custom.php include/help/es/help_snmp_alert_custom.php: Modified helps due to field renamed in thie view. * 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 id_group_filter in tevent_filter table. * operation/events/events_list.php operation/events/events.php godmode/events/event_edit_filter.php godmode/events/event_filter.php: If update button have been pushed toogle filter is not hide. And added group filter in live filter editor and in filter editor. * godmode/snmpconsole/snmp_alert.php: Changed position of fields and added helps. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5526 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- .../pandoradb_migrate_4.0.x_to_4.1.mysql.sql | 1 + .../pandoradb_migrate_4.0.x_to_4.1.oracle.sql | 1 + ...doradb_migrate_4.0.x_to_4.1.postgreSQL.sql | 1 + .../godmode/events/event_edit_filter.php | 63 ++++++++++------- .../godmode/events/event_filter.php | 6 +- .../godmode/snmpconsole/snmp_alert.php | 66 ++++++++++------- .../include/help/en/help_field_match_snmp.php | 9 +++ .../help/en/help_snmp_alert_configuration.php | 9 +++ .../help/en/help_snmp_alert_custom.php | 5 +- .../help/en/help_snmp_alert_filters.php | 9 +++ .../include/help/es/help_field_match_snmp.php | 9 +++ .../help/es/help_snmp_alert_configuration.php | 9 +++ .../help/es/help_snmp_alert_custom.php | 5 +- .../help/es/help_snmp_alert_filters.php | 9 +++ pandora_console/operation/events/events.php | 8 +++ .../operation/events/events_list.php | 70 ++++++++++++++----- pandora_console/pandoradb.oracle.sql | 1 + pandora_console/pandoradb.postgreSQL.sql | 1 + pandora_console/pandoradb.sql | 1 + 19 files changed, 208 insertions(+), 75 deletions(-) create mode 100644 pandora_console/include/help/en/help_field_match_snmp.php create mode 100644 pandora_console/include/help/en/help_snmp_alert_configuration.php create mode 100644 pandora_console/include/help/en/help_snmp_alert_filters.php create mode 100644 pandora_console/include/help/es/help_field_match_snmp.php create mode 100644 pandora_console/include/help/es/help_snmp_alert_configuration.php create mode 100644 pandora_console/include/help/es/help_snmp_alert_filters.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 d29227ed00..4e13781cc2 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 @@ -132,6 +132,7 @@ ALTER TABLE tgraph_source MODIFY weight FLOAT(5,3) NOT NULL DEFAULT '0.000'; CREATE TABLE IF NOT EXISTS `tevent_filter` ( `id_filter` int(10) unsigned NOT NULL auto_increment, + `id_group_filter` int(10) NOT NULL default 0, `id_name` varchar(600) NOT NULL, `id_group` int(10) NOT NULL default 0, `event_type` text NOT NULL 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 82793616a0..6b2cc8f048 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 @@ -127,6 +127,7 @@ ALTER TABLE talert_snmp add (single_value VARCHAR2(255) DEFAULT ''); -- ----------------------------------------------------- CREATE TABLE tevent_filter ( id_filter NUMBER(10, 0) NOT NULL PRIMARY KEY, + id_group_filter NUMBER(10, 0) default 0 NOT NULL, id_name VARCHAR2(600) NOT NULL, id_group NUMBER(10, 0) default 0 NOT NULL, event_type CLOB default '' NOT NULL, 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 c4da9de0aa..be37b7d066 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 @@ -112,6 +112,7 @@ ALTER TABLE "talert_snmp" ADD COLUMN "single_value" varchar(255) DEFAULT ''; -- ----------------------------------------------------- CREATE TABLE "tevent_filter" ( "id_filter" SERIAL NOT NULL PRIMARY KEY, + "id_group_filter" INTEGER NOT NULL default 0, "id_name" varchar(600) NOT NULL, "id_group" INTEGER NOT NULL default 0, "event_type" TEXT NOT NULL default '', diff --git a/pandora_console/godmode/events/event_edit_filter.php b/pandora_console/godmode/events/event_edit_filter.php index d5261cf7d4..c8e62b3e04 100644 --- a/pandora_console/godmode/events/event_edit_filter.php +++ b/pandora_console/godmode/events/event_edit_filter.php @@ -53,6 +53,7 @@ ui_print_page_header (__("Manage events") . ' - ' . __('Filters'), "images/light if ($id) { $filter = events_get_event_filter ($id); + $id_group_filter = $filter['id_group_filter']; $id_group = $filter['id_group']; $id_name = $filter['id_name']; $event_type = $filter['event_type']; @@ -68,6 +69,7 @@ if ($id) { $filter_only_alert = $filter['filter_only_alert']; } else { $id_group = ''; + $id_group_filter = ''; $id_name = ''; $event_type = ''; $severity = ''; @@ -84,6 +86,7 @@ if ($id) { if ($update) { $id_group = (string) get_parameter ('id_group'); + $id_group_filter = get_parameter('id_group_filter'); $id_name = (string) get_parameter ('id_name'); $event_type = get_parameter('event_type', ''); $severity = get_parameter('severity', ''); @@ -102,6 +105,7 @@ if ($update) { } else { $values = array ('id_filter' => $id, 'id_name' => $id_name, + 'id_group_filter' => $id_group_filter, 'id_group' => $id_group, 'event_type' => $event_type, 'severity' => $severity, @@ -127,6 +131,7 @@ if ($update) { if ($create) { $id_group = (string) get_parameter ('id_group'); $id_name = (string) get_parameter ('id_name'); + $id_group_filter = get_parameter('id_group_filter'); $event_type = get_parameter('event_type', ''); $severity = get_parameter('severity', ''); $status = get_parameter('status', ''); @@ -140,7 +145,8 @@ if ($create) { $filter_only_alert = get_parameter('filter_only_alert', ''); $values = array ( - 'id_name' => $id_name, + 'id_name' => $id_name, + 'id_group_filter' => $id_group_filter, 'id_group' => $id_group, 'event_type' => $event_type, 'severity' => $severity, @@ -172,12 +178,17 @@ $table->class = "databox_color"; $table->style[0] = 'vertical-align: top;'; $table->data = array (); -$table->data[0][0] = '<b>'.__('Name').'</b>'; +$table->data[0][0] = '<b>'.__('Filter name').'</b>'; $table->data[0][1] = html_print_input_text ('id_name', $id_name, false, 20, 80, true); -$own_info = get_user_info ($config['id_user']); -$table->data[1][0] = '<b>'.__('Group').'</b>'; +$table->data[1][0] = '<b>'.__('Filter group').'</b>' . ui_print_help_tip(__('This group will be use to restrict the visibility of this filter with ACLs'), true); $table->data[1][1] = html_print_select_groups($config['id_user'], "IW", + $own_info['is_admin'], 'id_group_filter', $id_group_filter, '', '', -1, true, + false, false); + +$own_info = get_user_info ($config['id_user']); +$table->data[2][0] = '<b>'.__('Group').'</b>'; +$table->data[2][1] = html_print_select_groups($config['id_user'], "IW", $own_info['is_admin'], 'id_group', $id_group, '', '', -1, true, false, false); @@ -185,23 +196,23 @@ $types = get_event_types (); // Expand standard array to add not_normal (not exist in the array, used only for searches) $types["not_normal"] = __("Not normal"); -$table->data[2][0] = '<b>' . __('Event type') . '</b>'; -$table->data[2][1] = html_print_select ($types, 'event_type', $event_type, '', __('All'), '', true); +$table->data[3][0] = '<b>' . __('Event type') . '</b>'; +$table->data[3][1] = html_print_select ($types, 'event_type', $event_type, '', __('All'), '', true); -$table->data[3][0] = '<b>' . __('Severity') . '</b>'; -$table->data[3][1] = html_print_select (get_priorities (), "severity", $severity, '', __('All'), '-1', true); +$table->data[4][0] = '<b>' . __('Severity') . '</b>'; +$table->data[4][1] = html_print_select (get_priorities (), "severity", $severity, '', __('All'), '-1', true); $fields = events_get_all_status(); -$table->data[4][0] = '<b>' . __('Event status') . '</b>'; -$table->data[4][1] = html_print_select ($fields, 'status', $status, '', '', '', true); +$table->data[5][0] = '<b>' . __('Event status') . '</b>'; +$table->data[5][1] = html_print_select ($fields, 'status', $status, '', '', '', true); -$table->data[5][0] = '<b>' . __('Free search') . '</b>'; -$table->data[5][1] = html_print_input_text ('search', io_safe_output($search), '', 15, 255, true); +$table->data[6][0] = '<b>' . __('Free search') . '</b>'; +$table->data[6][1] = html_print_input_text ('search', io_safe_output($search), '', 15, 255, true); -$table->data[6][0] = '<b>' . __('Agent search') . '</b>'; +$table->data[7][0] = '<b>' . __('Agent search') . '</b>'; $src_code = html_print_image('images/lightning.png', true, false, true); -$table->data[6][1] = html_print_input_text_extended ('text_agent', $text_agent, 'text_id_agent', '', 30, 100, false, '', +$table->data[7][1] = html_print_input_text_extended ('text_agent', $text_agent, 'text_id_agent', '', 30, 100, false, '', array('style' => 'background: url(' . $src_code . ') no-repeat right;'), true) . '<a href="#" class="tip"> <span>' . __("Type at least two characters to search") . '</span></a>'; @@ -210,20 +221,20 @@ $lpagination[50] = 50; $lpagination[100] = 100; $lpagination[200] = 200; $lpagination[500] = 500; -$table->data[7][0] = '<b>' . __('Block size for pagination') . '</b>'; -$table->data[7][1] = html_print_select ($lpagination, "pagination", $pagination, '', __('Default'), $config["block_size"], true); +$table->data[8][0] = '<b>' . __('Block size for pagination') . '</b>'; +$table->data[8][1] = html_print_select ($lpagination, "pagination", $pagination, '', __('Default'), $config["block_size"], true); -$table->data[8][0] = '<b>' . __('Max. hours old') . '</b>'; -$table->data[8][1] = html_print_input_text ('event_view_hr', $event_view_hr, '', 5, 255, true); +$table->data[9][0] = '<b>' . __('Max. hours old') . '</b>'; +$table->data[9][1] = html_print_input_text ('event_view_hr', $event_view_hr, '', 5, 255, true); -$table->data[9][0] = '<b>' . __('User ack.') . '</b>'; +$table->data[10][0] = '<b>' . __('User ack.') . '</b>'; $users = users_get_info (); -$table->data[9][1] = html_print_select ($users, "id_user_ack", $id_user_ack, '', __('Any'), 0, true); +$table->data[10][1] = html_print_select ($users, "id_user_ack", $id_user_ack, '', __('Any'), 0, true); $repeated_sel[0] = __("All events"); $repeated_sel[1] = __("Group events"); -$table->data[10][0] = '<b>' . __('Repeated') . '</b>'; -$table->data[10][1] = html_print_select ($repeated_sel, "group_rep", $group_rep, '', '', '', true); +$table->data[11][0] = '<b>' . __('Repeated') . '</b>'; +$table->data[11][1] = html_print_select ($repeated_sel, "group_rep", $group_rep, '', '', '', true); $tags = tags_search_tag(); if($tags === false) { @@ -235,11 +246,11 @@ foreach($tags as $t) { $tags_name[$t['name']] = $t['name']; } -$table->data[11][0] = '<b>' . __('Tag') . '</b>'; -$table->data[11][1] = html_print_select ($tags_name, "tag", $tag, '', __('All'), "", true); +$table->data[12][0] = '<b>' . __('Tag') . '</b>'; +$table->data[12][1] = html_print_select ($tags_name, "tag", $tag, '', __('All'), "", true); -$table->data[12][0] = '<b>' . __('Alert events') . '</b>'; -$table->data[12][1] = html_print_select (array('-1' => __('All'), '0' => __('Filter alert events'), '1' => __('Only alert events')), "filter_only_alert", $filter_only_alert, '', '', '', true); +$table->data[13][0] = '<b>' . __('Alert events') . '</b>'; +$table->data[13][1] = html_print_select (array('-1' => __('All'), '0' => __('Filter alert events'), '1' => __('Only alert events')), "filter_only_alert", $filter_only_alert, '', '', '', true); echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/event_edit_filter">'; html_print_table ($table); diff --git a/pandora_console/godmode/events/event_filter.php b/pandora_console/godmode/events/event_filter.php index 58a922f1c3..6cb913a56a 100644 --- a/pandora_console/godmode/events/event_filter.php +++ b/pandora_console/godmode/events/event_filter.php @@ -102,7 +102,7 @@ $own_info = get_user_info ($config['id_user']); // Get group list that user has access $groups_user = users_get_groups ($config['id_user'], "AW", $own_info['is_admin'], true); -$sql = "SELECT * FROM tevent_filter WHERE id_group IN (".implode(',', array_keys ($groups_user)).")"; +$sql = "SELECT * FROM tevent_filter WHERE id_group_filter IN (".implode(',', array_keys ($groups_user)).")"; $filters = db_get_all_rows_sql($sql); if ($filters === false) @@ -111,7 +111,7 @@ if ($filters === false) $table->width = '98%'; $table->head = array (); $table->head[0] = __('Name'); -$table->head[1] = __('Group'); +$table->head[1] = __('Filter group'); $table->head[2] = __('Event type'); $table->head[3] = __('Event status'); $table->head[4] = __('Severity'); @@ -143,7 +143,7 @@ foreach ($filters as $filter) { $data = array (); $data[0] = '<a href="index.php?sec=geventos&sec2=godmode/events/event_edit_filter&id='.$filter['id_filter'].'">'.$filter['id_name'].'</a>'; - $data[1] = ui_print_group_icon ($filter['id_group'], true); + $data[1] = ui_print_group_icon ($filter['id_group_filter'], true); $data[2] = events_get_event_types($filter['event_type']); $data[3] = events_get_status($filter['status']); $data[4] = events_get_severity_types($filter['severity']); diff --git a/pandora_console/godmode/snmpconsole/snmp_alert.php b/pandora_console/godmode/snmpconsole/snmp_alert.php index 893c49915f..88a7d51b42 100644 --- a/pandora_console/godmode/snmpconsole/snmp_alert.php +++ b/pandora_console/godmode/snmpconsole/snmp_alert.php @@ -185,7 +185,9 @@ if (isset ($_GET["delete_alert"])) { // Delete alert if (isset ($_GET["update_alert"])) { //the update_alert means the form should be displayed. If update_alert > 1 then an existing alert is updated echo '<form name="agente" method="post" action="index.php?sec=gsnmpconsole&sec2=godmode/snmpconsole/snmp_alert&submit='.$id_as.'">'; - echo '<table cellpadding="4" cellspacing="4" width="98%" class="databox_color">'; + echo '<table cellpadding="4" cellspacing="4" width="98%" class="databox_color" style="border:1px solid #A9A9A9;">'; + + echo '<tr><td class="datos"><b>' . __('Alert configuration') . ui_print_help_icon("snmp_alert_configuration", true) . '</b></td></tr>'; // Alert type (e-mail, event etc.) echo '<tr><td class="datos">'.__('Alert action').'</td><td class="datos">'; @@ -223,25 +225,17 @@ if (isset ($_GET["update_alert"])) { html_print_input_text ("oid", $oid, '', 50); echo '</td></tr>'; - // Custom - echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Global match'); - echo ui_print_help_icon ("snmp_alert_custom", true); - - echo '</td><td class="datos">'; - html_print_textarea ("custom_value", $custom_value, 2, $custom_value, 'style="width:400px;"'); - - echo '</td></tr>'; // Custom OID/Data #1 - echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data #1'); - //echo ui_print_help_icon ("snmp_alert_custom", true); + echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Field #1 Match'); + echo ui_print_help_icon ("field_match_snmp", true); echo '</td><td class="datos">'; html_print_input_text ("custom_oid_data_1", $custom_oid_data_1, '', 60); echo '</td></tr>'; // Custom OID/Data #2 - echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data #2'); + echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Field #2 Match'); //echo ui_print_help_icon ("snmp_alert_custom", true); echo '</td><td class="datos">'; @@ -249,7 +243,7 @@ if (isset ($_GET["update_alert"])) { echo '</td></tr>'; // Custom OID/Data #3 - echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data #3'); + echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Field #3 Match'); //echo ui_print_help_icon ("snmp_alert_custom", true); echo '</td><td class="datos">'; @@ -257,7 +251,7 @@ if (isset ($_GET["update_alert"])) { echo '</td></tr>'; // Custom OID/Data #4 - echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data #4'); + echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Field #4 Match'); //echo ui_print_help_icon ("snmp_alert_custom", true); echo '</td><td class="datos">'; @@ -265,7 +259,7 @@ if (isset ($_GET["update_alert"])) { echo '</td></tr>'; // Custom OID/Data #5 - echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data #5'); + echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Field #5 Match'); //echo ui_print_help_icon ("snmp_alert_custom", true); echo '</td><td class="datos">'; @@ -273,18 +267,13 @@ if (isset ($_GET["update_alert"])) { echo '</td></tr>'; // Custom OID/Data #6 - echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data #6'); + echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Field #6 Match'); //echo ui_print_help_icon ("snmp_alert_custom", true); echo '</td><td class="datos">'; html_print_input_text ("custom_oid_data_6", $custom_oid_data_6, '', 60); echo '</td></tr>'; - - // SNMP Agent - echo '<tr id="tr-source_ip"><td class="datos2">'.__('SNMP Agent').' (IP)</td><td class="datos2">'; - html_print_input_text ("source_ip", $source_ip, '', 20); - echo '</td></tr>'; - + // Alert fields echo '<tr><td class="datos">'.__('Field #1 (Alias, name)'); echo ui_print_help_icon ("snmp_alert_field1", true); @@ -334,6 +323,27 @@ if (isset ($_GET["update_alert"])) { echo '<tr><td class="datos">'.__('Priority').'</td><td class="datos">'; echo html_print_select (get_priorities (), "priority", $priority, '', '', '0', false, false, false); echo '</td></tr>'; + echo '</table>'; + + /* SNMP alert filters */ + + echo '<table cellpadding="4" cellspacing="4" width="98%" class="databox_color" style="border:1px solid #A9A9A9;">'; + + echo '<tr><td class="datos"><b>' . __('Alert filters') . ui_print_help_icon("snmp_alert_filters", true) . '</b></td></tr>'; + + // Custom + echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom Value/OID'); + echo ui_print_help_icon ("snmp_alert_custom", true); + + echo '</td><td class="datos">'; + html_print_textarea ("custom_value", $custom_value, 2, $custom_value, 'style="width:400px;"'); + + echo '</td></tr>'; + + // SNMP Agent + echo '<tr id="tr-source_ip"><td class="datos2">'.__('SNMP Agent').' (IP)</td><td class="datos2">'; + html_print_input_text ("source_ip", $source_ip, '', 20); + echo '</td></tr>'; // Trap type echo '<tr><td class="datos">'.__('Trap type').'</td><td class="datos">'; @@ -347,15 +357,21 @@ if (isset ($_GET["update_alert"])) { echo '</td></tr>'; //Button + //echo '<tr><td></td><td align="right">'; + + + // End table + echo "</td></tr></table>"; + + echo "<table style='width:98%'>"; echo '<tr><td></td><td align="right">'; if ($id_as > 0) { html_print_submit_button (__('Update'), "submit", false, 'class="sub upd"', false); } else { html_print_submit_button (__('Create'), "submit", false, 'class="sub wand"', false); } - - // End table - echo "</td></tr></table>"; + echo '</td></tr></table>'; + echo "</table>"; } else { require_once ('include/functions_alerts.php'); diff --git a/pandora_console/include/help/en/help_field_match_snmp.php b/pandora_console/include/help/en/help_field_match_snmp.php new file mode 100644 index 0000000000..b03a07f565 --- /dev/null +++ b/pandora_console/include/help/en/help_field_match_snmp.php @@ -0,0 +1,9 @@ +<?php +/* +* @package Include /help/en +*/ +?> + +<h1>Fields match 1-6</h1> + +<p>There are regular expressions. It is possible to use selectors in order to select a part of the regular expression that will be load in _snmp_fx_ macro. You can use these macros in Field #1 (Alias, name), Field #2 (Single Line) and Field #3 (Full Text).</p> diff --git a/pandora_console/include/help/en/help_snmp_alert_configuration.php b/pandora_console/include/help/en/help_snmp_alert_configuration.php new file mode 100644 index 0000000000..290a98aaa6 --- /dev/null +++ b/pandora_console/include/help/en/help_snmp_alert_configuration.php @@ -0,0 +1,9 @@ +<?php +/* +* @package Include /help/en +*/ +?> + +<h1>Alert configuration</h1> + +<p>These are the fields needed to perfom the SNMP alert configuration. Part of the fields could be parametrized by the macros obtained in fields "Field #x Match" and "Custom Value/OID".</p> diff --git a/pandora_console/include/help/en/help_snmp_alert_custom.php b/pandora_console/include/help/en/help_snmp_alert_custom.php index 33058b016e..00ef6ad872 100644 --- a/pandora_console/include/help/en/help_snmp_alert_custom.php +++ b/pandora_console/include/help/en/help_snmp_alert_custom.php @@ -4,6 +4,7 @@ */ ?> -<h1>Global match</h1> +<h1>Custom Value/OID</h1> -<p>This search in the trap "Value" fields, and also in the fields "Custom OID" and "Custom Value", that is, in the rest of the TRAP fields.</p> +<p>This search in the trap "Value" fields, and also in the fields "Custom OID" and "Custom Value", that is, in the rest of the TRAP fields. If you use a regular expression you can use selectors in order to load _snmp_f1_, _snmp_f2_ and _snmp_f3_ macros and replace it in Field #1 (Alias, name), Field #2 (Single Line) +and Field #3 (Full Text).</p> diff --git a/pandora_console/include/help/en/help_snmp_alert_filters.php b/pandora_console/include/help/en/help_snmp_alert_filters.php new file mode 100644 index 0000000000..bb316eb4b2 --- /dev/null +++ b/pandora_console/include/help/en/help_snmp_alert_filters.php @@ -0,0 +1,9 @@ +<?php +/* +* @package Include /help/en +*/ +?> + +<h1>Alert filters</h1> + +<p>These are the conditions needed to fire the SNMP alert. All conditions must be fullfiled in order to fire the SNMP alert.</p> diff --git a/pandora_console/include/help/es/help_field_match_snmp.php b/pandora_console/include/help/es/help_field_match_snmp.php new file mode 100644 index 0000000000..02c2dae108 --- /dev/null +++ b/pandora_console/include/help/es/help_field_match_snmp.php @@ -0,0 +1,9 @@ +<?php +/* +* @package Include /help/es +*/ +?> + +<h1>Fields match 1-6</h1> + +<p>Son expresiones regulares. Es posible usar selectores para seleccionar parte de la expresión regular que se cargará en la macro _snmp_fx_. Puedes usar estas macros en los campos Field #1 (Alias, name), Field #2 (Single Line) y Field #3 (Full Text).</p> diff --git a/pandora_console/include/help/es/help_snmp_alert_configuration.php b/pandora_console/include/help/es/help_snmp_alert_configuration.php new file mode 100644 index 0000000000..bb3c08203a --- /dev/null +++ b/pandora_console/include/help/es/help_snmp_alert_configuration.php @@ -0,0 +1,9 @@ +<?php +/* +* @package Include /help/es +*/ +?> + +<h1>Alert configuration</h1> + +<p>Estos campos son necesarios para realizar la configuración de la alerta SNMP. Parte de estos campos pueden ser configurados por las macros obtenidas por los campos "Field #x Match" y "Custom Value/OID".</p> diff --git a/pandora_console/include/help/es/help_snmp_alert_custom.php b/pandora_console/include/help/es/help_snmp_alert_custom.php index 92ab2643ce..fb2882fc4e 100644 --- a/pandora_console/include/help/es/help_snmp_alert_custom.php +++ b/pandora_console/include/help/es/help_snmp_alert_custom.php @@ -4,6 +4,7 @@ */ ?> -<h1>Global match</h1> +<h1>Custom Value/OID</h1> -<p>Campos personalizados enviados en el trap. Pueden ser datos muy complejos, que tengan una lógica específica en función del dispositivo que envía el trap. Un trap puede enviar varios datos en este campo.</p> +<p>Campos personalizados enviados en el trap. Pueden ser datos muy complejos, que tengan una lógica específica en función del dispositivo que envía el trap. Un trap puede enviar varios datos en este campo. Si usas expresion regular puedes usar selectores para cargar las macros _snmp_f1_, _snmp_f2_ y _snmp_f3_ y reemplazarlas Field #1 (Alias, name), Field #2 (Single Line) +y Field #3 (Full Text).</p> diff --git a/pandora_console/include/help/es/help_snmp_alert_filters.php b/pandora_console/include/help/es/help_snmp_alert_filters.php new file mode 100644 index 0000000000..1ee32f5bf3 --- /dev/null +++ b/pandora_console/include/help/es/help_snmp_alert_filters.php @@ -0,0 +1,9 @@ +<?php +/* +* @package Include /help/es +*/ +?> + +<h1>Alert filters</h1> + +<p>Estas son las condiciones necesarias para que se dispare la alerta SNMP. Todas las condiciones tienen que satisfacerse para que la alarma SNMP se dispare.</p> diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 4663d53cb3..9a9d4fe345 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -170,6 +170,7 @@ $text_agent = (string) get_parameter('text_agent', __("All")); $filter_only_alert = (int) get_parameter('filter_only_alert', -1); $filter_id = (int) get_parameter('filter_id', 0); $id_name = (string) get_parameter('id_name', ''); +$id_group = (int) get_parameter('id_group', 0); $search = io_safe_output(preg_replace ("/&([A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "&", rawurldecode (get_parameter ("search")))); @@ -379,6 +380,13 @@ $(document).ready( function() { $("#tgl_event_control").click (function () { $("#event_control").toggle (); + // Trick to don't collapse filter if autorefresh button has been pushed + if ($("#hidden-toogle_filter").val() == 'true'){ + $("#hidden-toogle_filter").val('false'); + } + else{ + $("#hidden-toogle_filter").val('true'); + } return false; }); diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php index 79e759b5ae..f8f05dff98 100644 --- a/pandora_console/operation/events/events_list.php +++ b/pandora_console/operation/events/events_list.php @@ -68,7 +68,8 @@ if (is_ajax()){ $values['id_user_ack'] = get_parameter('id_user_ack'); $values['group_rep'] = get_parameter('group_rep'); $values['tag'] = get_parameter('tag'); - $values['filter_only_alert'] = get_parameter('filter_only_alert'); + $values['filter_only_alert'] = get_parameter('filter_only_alert'); + $values['id_group_filter'] = get_parameter('id_group_filter'); $result = db_process_sql_insert('tevent_filter', $values); @@ -95,9 +96,9 @@ if (is_ajax()){ $values['id_user_ack'] = get_parameter('id_user_ack'); $values['group_rep'] = get_parameter('group_rep'); $values['tag'] = get_parameter('tag'); - $values['filter_only_alert'] = get_parameter('filter_only_alert'); - - + $values['filter_only_alert'] = get_parameter('filter_only_alert'); + $values['id_group_filter'] = get_parameter('id_group_filter'); + $result = db_process_sql_update('tevent_filter', $values, array('id_filter' => $id)); if ($result === false){ @@ -251,12 +252,17 @@ echo '<a href="#" id="tgl_event_control"><b>'.__('Event control filter').'</b>&n echo '<div id="event_control" style="display:none">'; // Table for filter controls -echo '<form method="post" action="index.php?sec=eventos&sec2=operation/events/events&refr='.$config["refr"].'&pure='.$config["pure"].'&section=list">'; +echo '<form id="form_filter" method="post" action="index.php?sec=eventos&sec2=operation/events/events&refr='.$config["refr"].'&pure='.$config["pure"].'&section=list">'; echo '<table style="float:left;" width="550" cellpadding="4" cellspacing="4" class="databox"><tr id="row_name" style="visibility: hidden">'; -// Group combo +// Filter name echo "<td>".__('Filter name')."</td><td>"; html_print_input_text ('id_name', $id_name, '', 15); +echo "</td>"; + +// Filter group +echo "<td>".__('Filter group')."</td><td>"; +html_print_select_groups($config["id_user"], "IR", true, 'id_group', $id_group, '', '', 0, false, false, false, 'w130'); echo "</td></tr>"; // Group combo @@ -377,10 +383,29 @@ echo '</td></tr>'; echo '<tr><td colspan="4" style="text-align:right">'; + +// Trick to catch if the update button has been pushed (don't collapse filter) +// or autorefresh is in use (collapse filter) +$autorefresh_toogle = get_parameter_get('toogle_filter', 'true'); +$update_pressed = get_parameter_post('toogle_filter', 'true'); +// If autoupdate is in use collapse filter +if ($autorefresh_toogle == 'false'){ + html_print_input_hidden('toogle_filter', 'true'); +} +else{ + // If update button has been pushed then don't collapse filter + if ($update_pressed == 'false'){ + html_print_input_hidden('toogle_filter', 'false'); + } // Else collapse filter + else{ + html_print_input_hidden('toogle_filter', 'true'); + } +} + //The buttons html_print_submit_button (__('Update filter'), 'update_filter', false, 'class="sub upd" style="visibility:hidden"'); html_print_submit_button (__('Save filter'), 'save_filter', false, 'class="sub upd"'); -html_print_submit_button (__('Update'), '', false, 'class="sub upd"'); +html_print_submit_button (__('Update'), 'update', false, 'class="sub upd"'); echo "</td></tr></table></form>"; //This is the filter div echo '<div style="width:220px; float:left;">'; @@ -1062,6 +1087,12 @@ unset ($table); /* <![CDATA[ */ $(document).ready( function() { + + // Don't collapse filter if update button has been pushed + if ($("#hidden-toogle_filter").val() == 'false'){ + $("#event_control").toggle (); + } + // If selected is not 'none' show filter name if ( $("#filter_id").val() != 0 ) { $("#row_name").css('visibility', ''); @@ -1085,7 +1116,8 @@ $(document).ready( function() { $("#tag").val(''); $("#filter_only_alert").val(-1); $("#row_name").css('visibility', 'hidden'); - $("#submit-update_filter").css('visibility', 'hidden'); + $("#submit-update_filter").css('visibility', 'hidden'); + $("#id_group").val(0); } // If filter selected then load filter else { @@ -1124,6 +1156,8 @@ $(document).ready( function() { $("#tag").val(val); if (i == 'filter_only_alert') $("#filter_only_alert").val(val); + if (i == 'id_group_filter') + $("#id_group").val(val); }); }, "json" @@ -1136,12 +1170,12 @@ $(document).ready( function() { // Checks if the filter has name or not if ($('#row_name').css('visibility') == 'hidden') { $('#row_name').css('visibility', ''); - $('#show_filter_error').html('<h3 class="error">Define a name for the filter and click on Save filter again</h3>'); + $('#show_filter_error').html('<h3 class="error"> <? echo __('Define name and group for the filter and click on Save filter again'); ?> </h3>'); // If the filter has name insert in database }else{ // If the filter name is blank show error if ($('#text-id_name').val() == '') { - $('#show_filter_error').html('<h3 class="error">Filter name cannot be left blank</h3>'); + $('#show_filter_error').html('<h3 class="error"> <? echo __('Filter name cannot be left blank'); ?> </h3>'); return false; } @@ -1162,14 +1196,15 @@ $(document).ready( function() { "id_user_ack" : $("#id_user_ack").val(), "group_rep" : $("#group_rep").val(), "tag" : $("#tag").val(), - "filter_only_alert" : $("#filter_only_alert").val() + "filter_only_alert" : $("#filter_only_alert").val(), + "id_group_filter": $("#id_group").val() }, function (data) { if (data == 'error'){ - $('#show_filter_error').html('<h3 class="error">Error creating filter</h3>'); + $('#show_filter_error').html('<h3 class="error"> <? echo __('Error creating filter'); ?> </h3>'); }else{ id_filter_save = data; - $('#show_filter_error').html('<h3 class="suc">Filter created</h3>'); + $('#show_filter_error').html('<h3 class="suc"> <? echo __('Filter created'); ?> </h3>'); } }); @@ -1204,7 +1239,7 @@ $(document).ready( function() { // If the filter name is blank show error if ($('#text-id_name').val() == '') { - $('#show_filter_error').html('<h3 class="error">Filter name cannot be left blank</h3>'); + $('#show_filter_error').html('<h3 class="error"> <?php echo __('Filter name cannot be left blank'); ?> </h3>'); return false; } @@ -1226,13 +1261,14 @@ $(document).ready( function() { "id_user_ack" : $("#id_user_ack").val(), "group_rep" : $("#group_rep").val(), "tag" : $("#tag").val(), - "filter_only_alert" : $("#filter_only_alert").val() + "filter_only_alert" : $("#filter_only_alert").val(), + "id_group_filter": $("#id_group").val() }, function (data) { if (data == 'ok'){ - $('#show_filter_error').html('<h3 class="suc">Filter updated</h3>'); + $('#show_filter_error').html('<h3 class="suc"> <?php echo __('Filter updated'); ?> </h3>'); }else{ - $('#show_filter_error').html('<h3 class="error">Error updating filter</h3>'); + $('#show_filter_error').html('<h3 class="error"> <?php echo __('Error updating filter'); ?> </h3>'); } }); diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index c96aa576a3..075ce8e480 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -1561,6 +1561,7 @@ CREATE OR REPLACE TRIGGER tnetflow_report_content_inc BEFORE INSERT ON tnetflow_ -- ----------------------------------------------------- CREATE TABLE tevent_filter ( id_filter NUMBER(10, 0) NOT NULL PRIMARY KEY, + id_group_filter NUMBER(10, 0) default 0 NOT NULL, id_name VARCHAR2(600) NOT NULL, id_group NUMBER(10, 0) default 0 NOT NULL, event_type CLOB default '' NOT NULL, diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index f7adec102c..9a85414364 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -1259,6 +1259,7 @@ CREATE TABLE "tnetflow_report_content" ( -- ----------------------------------------------------- CREATE TABLE "tevent_filter" ( "id_filter" SERIAL NOT NULL PRIMARY KEY, + "id_group_filter" INTEGER NOT NULL default 0, "id_name" varchar(600) NOT NULL, "id_group" INTEGER NOT NULL default 0, "event_type" TEXT NOT NULL default '', diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 1efb1f19c5..95c2d5ecfd 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1362,6 +1362,7 @@ CREATE TABLE IF NOT EXISTS `tnetflow_report_content` ( CREATE TABLE IF NOT EXISTS `tevent_filter` ( `id_filter` int(10) unsigned NOT NULL auto_increment, + `id_group_filter` int(10) NOT NULL default 0, `id_name` varchar(600) NOT NULL, `id_group` int(10) NOT NULL default 0, `event_type` text NOT NULL default '',