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 d05de1bac1..536a0c271a 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 @@ -102,3 +102,10 @@ ON DELETE CASCADE; ALTER TABLE `tevento` ADD COLUMN (`source` tinytext NOT NULL DEFAULT '', `unique_id` tinytext NOT NULL DEFAULT '', `id_extra` tinytext NOT NULL DEFAULT ''); + +-- ----------------------------------------------------- +-- Table `talert_snmp` +-- ----------------------------------------------------- +ALTER TABLE `talert_snmp` ADD COLUMN (`_snmp_f1_` text DEFAULT '', `_snmp_f2_` text DEFAULT '', `_snmp_f3_` text DEFAULT '', +`_snmp_f4_` text DEFAULT '', `_snmp_f5_` text DEFAULT '', `_snmp_f6_` text DEFAULT '', `trap_type` int(11) NOT NULL default '-1', +`single_value` varchar(255) 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 c299fb8919..e43f08ee5a 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 @@ -110,4 +110,15 @@ alter table tevento add (source VARCHAR2(100) default '' NOT NULL); alter table tevento add (unique_id VARCHAR2(100) default '' NOT NULL); alter table tevento add (id_extra VARCHAR2(100) default '' NOT NULL); +-- ----------------------------------------------------- +-- Table `talert_snmp` +-- ----------------------------------------------------- +ALTER TABLE talert_snmp add (_snmp_f1_ CLOB default ''); +ALTER TABLE talert_snmp add (_snmp_f2_ CLOB default ''); +ALTER TABLE talert_snmp add (_snmp_f3_ CLOB default ''); +ALTER TABLE talert_snmp add (_snmp_f4_ CLOB default ''); +ALTER TABLE talert_snmp add (_snmp_f5_ CLOB default ''); +ALTER TABLE talert_snmp add (_snmp_f6_ CLOB default ''); +ALTER TABLE talert_snmp add (trap_type NUMBER(10, 0) DEFAULT -1 NOT NULL); +ALTER TABLE talert_snmp add (single_value VARCHAR2(255) 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 261e00051e..15d7759ba4 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 @@ -94,3 +94,16 @@ REFERENCES "tplanned_downtime"("id"); ALTER TABLE "tevento" ADD COLUMN "source" text NULL default ''; ALTER TABLE "tevento" ADD COLUMN "unique_id" text NULL default ''; ALTER TABLE "tevento" ADD COLUMN "id_extra" text NULL default ''; + +-- ----------------------------------------------------- +-- Table `talert_snmp` +-- ----------------------------------------------------- + +ALTER TABLE "talert_snmp" ADD COLUMN "_snmp_f1_" text DEFAULT ''; +ALTER TABLE "talert_snmp" ADD COLUMN "_snmp_f2_" text DEFAULT ''; +ALTER TABLE "talert_snmp" ADD COLUMN "_snmp_f3_" text DEFAULT ''; +ALTER TABLE "talert_snmp" ADD COLUMN "_snmp_f4_" text DEFAULT ''; +ALTER TABLE "talert_snmp" ADD COLUMN "_snmp_f5_" text DEFAULT ''; +ALTER TABLE "talert_snmp" ADD COLUMN "_snmp_f6_" text DEFAULT ''; +ALTER TABLE "talert_snmp" ADD COLUMN "trap_type" INTEGER NOT NULL DEFAULT '-1'; +ALTER TABLE "talert_snmp" ADD COLUMN "single_value" varchar(255) DEFAULT ''; diff --git a/pandora_console/general/shortcut_bar.php b/pandora_console/general/shortcut_bar.php index e42b0c92d5..ffdaab990d 100644 --- a/pandora_console/general/shortcut_bar.php +++ b/pandora_console/general/shortcut_bar.php @@ -100,7 +100,7 @@ echo " "; echo ""; - html_print_image("images/bell.png", false, array("title" => __("Alerts fired"))); + html_print_image("images/bell.png", false, array("title" => __("Alerts fired"), "style" => "margin-bottom: -5px;")); echo " "; // Calculate alerts fired @@ -110,7 +110,7 @@ echo ""; echo " "; echo ""; - html_print_image("images/lightning_go.png", false, array("title" => __("Critical events"))); + html_print_image("images/lightning_go.png", false, array("title" => __("Critical events"), "style" => "margin-bottom: -5px;")); echo " "; // Calculate critical events (not validated) @@ -139,7 +139,7 @@ // Calculate opened incidents (id integria incidents are not enabled) if ($config['integria_enabled'] == 0){ echo ""; - html_print_image("images/book_edit.png", false, array("title" => __("Incidents opened"))); + html_print_image("images/book_edit.png", false, array("title" => __("Incidents opened"), "style" => "margin-bottom: -5px;")); echo " "; // Select only opened incidents $sql = "SELECT count(*) total_incidents FROM tincidencia WHERE @@ -165,13 +165,13 @@ echo " "; echo ""; - html_print_image("images/reporting.png", false, array("title" => __("View reports"))); + html_print_image("images/reporting.png", false, array("title" => __("View reports"), "style" => "margin-bottom: -5px;")); echo ""; echo " "; echo ""; - html_print_image("images/email.png", false, array("title" => __("Create new message"))); + html_print_image("images/email.png", false, array("title" => __("Create new message"), "style" => "margin-bottom: -5px;")); echo ""; // Login in Console and shortcut bar is disabled diff --git a/pandora_console/godmode/snmpconsole/snmp_alert.php b/pandora_console/godmode/snmpconsole/snmp_alert.php index 79dc4d66ca..893c49915f 100644 --- a/pandora_console/godmode/snmpconsole/snmp_alert.php +++ b/pandora_console/godmode/snmpconsole/snmp_alert.php @@ -46,6 +46,14 @@ if (isset ($_GET["update_alert"]) && $_GET["update_alert"] == "-1") { $max_alerts = (int) get_parameter_post ("max_alerts", 1); $min_alerts = (int) get_parameter_post ("min_alerts", 0); $priority = (int) get_parameter_post ("priority", 0); + $custom_oid_data_1 = (string) get_parameter ("custom_oid_data_1"); + $custom_oid_data_2 = (string) get_parameter ("custom_oid_data_2"); + $custom_oid_data_3 = (string) get_parameter ("custom_oid_data_3"); + $custom_oid_data_4 = (string) get_parameter ("custom_oid_data_4"); + $custom_oid_data_5 = (string) get_parameter ("custom_oid_data_5"); + $custom_oid_data_6 = (string) get_parameter ("custom_oid_data_6"); + $trap_type = (int) get_parameter ("trap_type", -1); + $single_value = (string) get_parameter ("single_value"); if ($time_threshold == -1) { $time_threshold = $time_other; @@ -64,7 +72,15 @@ if (isset ($_GET["update_alert"]) && $_GET["update_alert"] == "-1") { 'time_threshold' => $time_threshold, 'max_alerts' => $max_alerts, 'min_alerts' => $min_alerts, - 'priority' => $priority); + 'priority' => $priority, + '_snmp_f1_' => $custom_oid_data_1, + '_snmp_f2_' => $custom_oid_data_2, + '_snmp_f3_' => $custom_oid_data_3, + '_snmp_f4_' => $custom_oid_data_4, + '_snmp_f5_' => $custom_oid_data_5, + '_snmp_f6_' => $custom_oid_data_6, + 'trap_type' => $trap_type, + 'single_value' => $single_value); $result = db_process_sql_insert('talert_snmp', $values); @@ -78,9 +94,12 @@ if (isset ($_GET["update_alert"]) && $_GET["update_alert"] == "-1") { } else { $sql = sprintf ("UPDATE talert_snmp SET priority = %d, id_alert = %d, al_field1 = '%s', al_field2 = '%s', al_field3 = '%s', description = '%s', agent = '%s', custom_oid = '%s', - oid = '%s', time_threshold = %d, max_alerts = %d, min_alerts = %d WHERE id_as = %d", + oid = '%s', time_threshold = %d, max_alerts = %d, min_alerts = %d, _snmp_f1_ = '%s', _snmp_f2_ = '%s', _snmp_f3_ = '%s', _snmp_f4_ = '%s', + _snmp_f5_ = '%s', _snmp_f6_ = '%s', trap_type = %d, single_value = '%s' + WHERE id_as = %d", $priority, $alert_type, $al_field1, $al_field2, $al_field3, $description, $source_ip, $custom_value, - $oid, $time_threshold, $max_alerts, $min_alerts, $id_as); + $oid, $time_threshold, $max_alerts, $min_alerts, $custom_oid_data_1, $custom_oid_data_2, $custom_oid_data_3, + $custom_oid_data_4, $custom_oid_data_5, $custom_oid_data_6, $trap_type, $single_value, $id_as); $result = db_process_sql ($sql); @@ -113,6 +132,14 @@ if ((isset ($_GET["update_alert"])) && ($_GET["update_alert"] != -1)) { $max_alerts = $alert["max_alerts"]; $min_alerts = $alert["min_alerts"]; $priority = $alert["priority"]; + $custom_oid_data_1 = $alert["_snmp_f1_"]; + $custom_oid_data_2 = $alert["_snmp_f2_"]; + $custom_oid_data_3 = $alert["_snmp_f3_"]; + $custom_oid_data_4 = $alert["_snmp_f4_"]; + $custom_oid_data_5 = $alert["_snmp_f5_"]; + $custom_oid_data_6 = $alert["_snmp_f6_"]; + $trap_type = $alert["trap_type"]; + $single_value = $alert["single_value"]; } elseif (isset ($_GET["update_alert"])) { // Variable init $id_as = -1; @@ -128,6 +155,14 @@ if ((isset ($_GET["update_alert"])) && ($_GET["update_alert"] != -1)) { $max_alerts = 1; $min_alerts = 0; $priority = 0; + $custom_oid_data_1 = ''; + $custom_oid_data_2 = ''; + $custom_oid_data_3 = ''; + $custom_oid_data_4 = ''; + $custom_oid_data_5 = ''; + $custom_oid_data_6 = ''; + $trap_type = -1; + $single_value = ''; } // Header @@ -189,13 +224,61 @@ if (isset ($_GET["update_alert"])) { echo ''; // Custom - echo '
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.
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 10bb4cea2a..92ab2643ce 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,6 @@ */ ?> -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.
diff --git a/pandora_console/operation/snmpconsole/snmp_view.php b/pandora_console/operation/snmpconsole/snmp_view.php index 22a29a05d3..d4856af008 100644 --- a/pandora_console/operation/snmpconsole/snmp_view.php +++ b/pandora_console/operation/snmpconsole/snmp_view.php @@ -40,8 +40,9 @@ $search_string = (string) get_parameter ("search_string", ''); $free_search_string = (string) get_parameter ("free_search_string", ''); $pagination = (int) get_parameter ("pagination", $config["block_size"]); $offset = (int) get_parameter ('offset',0); +$trap_type = (int) get_parameter ('trap_type', -1); -$url = "index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&filter_agent=".$filter_agent."&filter_oid=".$filter_oid."&filter_severity=".$filter_severity."&filter_fired=".$filter_fired."&search_string=".$search_string."&free_search_string=".$free_search_string."&pagination=".$pagination."&offset=".$offset; +$url = "index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&filter_agent=".$filter_agent."&filter_oid=".$filter_oid."&filter_severity=".$filter_severity."&filter_fired=".$filter_fired."&search_string=".$search_string."&free_search_string=".$free_search_string."&pagination=".$pagination."&offset=".$offset . "&trap_type=" . $trap_type; if ($config["pure"]) { @@ -277,7 +278,14 @@ if ($filter_severity != -1) { } if ($filter_status != -1) $whereSubquery .= ' AND status = ' . $filter_status; - + +if ($trap_type == -1) { + $whereSubquery .= ' AND type NOT IN (0, 1, 2, 3, 4)'; +} +else { + $whereSubquery .= ' AND type = ' . $trap_type; +} + switch ($config["dbtype"]) { case "mysql": $sql = sprintf($sql, $whereSubquery, $offset, $pagination); @@ -341,6 +349,11 @@ $table->data[3][1] = html_print_select ($status, 'filter_status', $filter_status $table->data[3][3] = ''.__('Free search').'' . ui_print_help_tip(__('Search by any alphanumeric field in the trap'), true); $table->data[3][4] = html_print_input_text ('free_search_string', $free_search_string, '', 40, 0, true); +// Type filter (ColdStart, WarmStart, LinkDown, LinkUp, authenticationFailure, Other) +$table->data[4][1] = ''.__('Type').'' . ui_print_help_tip(__('Search by trap type'), true); +$trap_types = array(0 => 'Cold start (0)', 1 => 'Warm start (1)', 2 => 'Link down (2)', 3 => 'Link up (3)', 4 => 'Authentication failure (4)', -1 => 'Other'); +$table->data[4][2] = html_print_select ($trap_types, 'trap_type', $trap_type, 'this.form.submit();', '', '', true, false, false); + $filter = '