diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.mysql.sql index df75d4ab37..5cec945fd2 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.mysql.sql @@ -76,6 +76,24 @@ ALTER TABLE talert_templates ADD COLUMN `field13_recovery` TEXT NOT NULL DEFAULT ALTER TABLE talert_templates ADD COLUMN `field14_recovery` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_templates ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT ""; +-- --------------------------------------------------------------------- +-- Table `talert_snmp` +-- --------------------------------------------------------------------- +ALTER TABLE talert_snmp ADD COLUMN `al_field11` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_snmp ADD COLUMN `al_field12` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_snmp ADD COLUMN `al_field13` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_snmp ADD COLUMN `al_field14` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_snmp ADD COLUMN `al_field15` TEXT NOT NULL DEFAULT ""; + +-- --------------------------------------------------------------------- +-- Table `talert_snmp_action` +-- --------------------------------------------------------------------- +ALTER TABLE talert_snmp_action ADD COLUMN `al_field11` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_snmp_action ADD COLUMN `al_field12` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_snmp_action ADD COLUMN `al_field13` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_snmp_action ADD COLUMN `al_field14` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_snmp_action ADD COLUMN `al_field15` TEXT NOT NULL DEFAULT ""; + -- ---------------------------------------------------------------------- -- Table `tserver` -- ---------------------------------------------------------------------- @@ -99,6 +117,16 @@ UPDATE talert_actions SET `field4` = 'integria', `field9` = 'admin', `field10` = '_alert_description_' WHERE `id` = 4 AND `id_alert_command` = 11; +ALTER TABLE talert_actions ADD COLUMN `field11` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN `field12` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN `field13` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN `field14` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN `field15` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN `field11_recovery` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN `field12_recovery` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN `field13_recovery` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN `field14_recovery` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT ""; -- --------------------------------------------------------------------- -- Table `talert_commands` diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.oracle.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.oracle.sql index 401b0a5f65..26d87f1071 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.oracle.sql @@ -14,6 +14,24 @@ ALTER TABLE talert_templates ADD COLUMN field13_recovery CLOB DEFAULT ""; ALTER TABLE talert_templates ADD COLUMN field14_recovery CLOB DEFAULT ""; ALTER TABLE talert_templates ADD COLUMN field15_recovery CLOB DEFAULT ""; +-- --------------------------------------------------------------------- +-- Table `talert_snmp` +-- --------------------------------------------------------------------- +ALTER TABLE talert_snmp ADD COLUMN al_field11 CLOB DEFAULT ""; +ALTER TABLE talert_snmp ADD COLUMN al_field12 CLOB DEFAULT ""; +ALTER TABLE talert_snmp ADD COLUMN al_field13 CLOB DEFAULT ""; +ALTER TABLE talert_snmp ADD COLUMN al_field14 CLOB DEFAULT ""; +ALTER TABLE talert_snmp ADD COLUMN al_field15 CLOB DEFAULT ""; + +-- --------------------------------------------------------------------- +-- Table `talert_snmp_action` +-- --------------------------------------------------------------------- +ALTER TABLE talert_snmp_action ADD COLUMN al_field11 CLOB DEFAULT ""; +ALTER TABLE talert_snmp_action ADD COLUMN al_field12 CLOB DEFAULT ""; +ALTER TABLE talert_snmp_action ADD COLUMN al_field13 CLOB DEFAULT ""; +ALTER TABLE talert_snmp_action ADD COLUMN al_field14 CLOB DEFAULT ""; +ALTER TABLE talert_snmp_action ADD COLUMN al_field15 CLOB DEFAULT ""; + -- ---------------------------------------------------------------------- -- Table `tserver` -- ---------------------------------------------------------------------- @@ -38,6 +56,16 @@ UPDATE talert_actions SET field4 = 'integria', field9 = 'admin', field10 = '_alert_description_' WHERE id = 4 AND id_alert_command = 11; +ALTER TABLE talert_actions ADD COLUMN field11 CLOB DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN field12 CLOB DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN field13 CLOB DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN field14 CLOB DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN field15 CLOB DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN field11_recovery CLOB DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN field12_recovery CLOB DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN field13_recovery CLOB DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN field14_recovery CLOB DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN field15_recovery CLOB DEFAULT ""; -- --------------------------------------------------------------------- -- Table `talert_commands` diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.postgreSQL.sql index 5a4c5e90c9..982bfd7fd7 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.postgreSQL.sql @@ -54,3 +54,35 @@ ALTER TABLE talert_templates ADD COLUMN field12_recovery TEXT NOT NULL DEFAULT " ALTER TABLE talert_templates ADD COLUMN field13_recovery TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_templates ADD COLUMN field14_recovery TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_templates ADD COLUMN field15_recovery TEXT NOT NULL DEFAULT ""; + +-- --------------------------------------------------------------------- +-- Table `talert_snmp` +-- --------------------------------------------------------------------- +ALTER TABLE talert_snmp ADD COLUMN al_field11 TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_snmp ADD COLUMN al_field12 TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_snmp ADD COLUMN al_field13 TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_snmp ADD COLUMN al_field14 TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_snmp ADD COLUMN al_field15 TEXT NOT NULL DEFAULT ""; + +-- --------------------------------------------------------------------- +-- Table `talert_snmp_action` +-- --------------------------------------------------------------------- +ALTER TABLE talert_snmp_action ADD COLUMN al_field11 TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_snmp_action ADD COLUMN al_field12 TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_snmp_action ADD COLUMN al_field13 TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_snmp_action ADD COLUMN al_field14 TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_snmp_action ADD COLUMN al_field15 TEXT NOT NULL DEFAULT ""; + +-- --------------------------------------------------------------------- +-- Table `talert_actions` +-- --------------------------------------------------------------------- +ALTER TABLE talert_actions ADD COLUMN field11 TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN field12 TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN field13 TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN field14 TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN field15 TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN field11_recovery TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN field12_recovery TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN field13_recovery TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN field14_recovery TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_actions ADD COLUMN field15_recovery TEXT NOT NULL DEFAULT ""; diff --git a/pandora_console/godmode/alerts/alert_actions.php b/pandora_console/godmode/alerts/alert_actions.php index 8a2d72d44b..e2a061b550 100644 --- a/pandora_console/godmode/alerts/alert_actions.php +++ b/pandora_console/godmode/alerts/alert_actions.php @@ -149,7 +149,7 @@ if ($create_action) { $fields_values = array(); $info_fields = ''; $values = array(); - for($i=1;$i<=10;$i++) { + for($i=1;$i<=$config['max_macro_fields'];$i++) { $values['field'.$i] = (string) get_parameter ('field'.$i.'_value'); $info_fields .= ' Field'.$i.': ' . $values['field'.$i]; $values['field'.$i.'_recovery'] = (string) get_parameter ('field'.$i.'_recovery_value'); @@ -228,7 +228,7 @@ if ($update_action) { $info_fields = ''; $values = array(); - for ($i = 1; $i <= 10; $i++) { + for ($i = 1; $i <= $config['max_macro_fields']; $i++) { $values['field'.$i] = (string) get_parameter ('field'.$i.'_value'); $info_fields .= ' Field1: ' . $values['field'.$i]; $values['field'.$i.'_recovery'] = (string) get_parameter ('field'.$i.'_recovery_value'); diff --git a/pandora_console/godmode/alerts/alert_commands.php b/pandora_console/godmode/alerts/alert_commands.php index 10f72bc301..ae6423cd71 100644 --- a/pandora_console/godmode/alerts/alert_commands.php +++ b/pandora_console/godmode/alerts/alert_commands.php @@ -89,7 +89,7 @@ if (is_ajax ()) { } $fields_rows = array(); - for ($i = 1; $i <= 10; $i++) { + for ($i = 1; $i <= $config['max_macro_fields']; $i++) { if (($i == 5) && ($command['id'] == 3)){ continue; @@ -260,7 +260,7 @@ if ($create_command) { $fields_values = array(); $info_fields = ''; $values = array(); - for ($i=1;$i<=10;$i++) { + for ($i=1;$i<=$config['max_macro_fields'];$i++) { $fields_descriptions[] = (string) get_parameter ('field'.$i.'_description'); $fields_values[] = (string) get_parameter ('field'.$i.'_values'); $info_fields .= ' Field'.$i.': ' . $fields_values[$i - 1]; diff --git a/pandora_console/godmode/alerts/configure_alert_action.php b/pandora_console/godmode/alerts/configure_alert_action.php index cfc18f76cb..7157037af3 100644 --- a/pandora_console/godmode/alerts/configure_alert_action.php +++ b/pandora_console/godmode/alerts/configure_alert_action.php @@ -157,7 +157,7 @@ $table->data[5][2] = html_print_textarea ('command_recovery_preview', 5, 30, '', 'disabled="disabled"', true); $row = 6; -for ($i = 1; $i <= 10; $i++) { +for ($i = 1; $i <= $config['max_macro_fields']; $i++) { $table->data['field' . $i][0] = html_print_image( 'images/spinner.gif', true); $table->data['field' . $i][1] = html_print_image( @@ -273,8 +273,8 @@ $(document).ready (function () { command_description = js_html_entity_decode (data["description"]); render_command_description(command_description); - - for (i = 1; i <= 10; i++) { + var max_fields = parseInt(''); + for (i = 1; i <= max_fields; i++) { var old_value = ''; var old_recovery_value = ''; var field_row = data["fields_rows"][i]; diff --git a/pandora_console/godmode/snmpconsole/snmp_alert.php b/pandora_console/godmode/snmpconsole/snmp_alert.php index 57627131bc..f681991580 100755 --- a/pandora_console/godmode/snmpconsole/snmp_alert.php +++ b/pandora_console/godmode/snmpconsole/snmp_alert.php @@ -58,6 +58,11 @@ if ($add_action) { $values[db_escape_key_identifier('al_field8')] = get_parameter('field8_value'); $values[db_escape_key_identifier('al_field9')] = get_parameter('field9_value'); $values[db_escape_key_identifier('al_field10')] = get_parameter('field10_value'); + $values[db_escape_key_identifier('al_field11')] = get_parameter('field11_value'); + $values[db_escape_key_identifier('al_field12')] = get_parameter('field12_value'); + $values[db_escape_key_identifier('al_field13')] = get_parameter('field13_value'); + $values[db_escape_key_identifier('al_field14')] = get_parameter('field14_value'); + $values[db_escape_key_identifier('al_field15')] = get_parameter('field15_value'); $result = db_process_sql_insert('talert_snmp_action', $values); } @@ -102,6 +107,11 @@ if ($save_alert || $modify_alert) { $al_field8 = (string) get_parameter_post ("field8_value"); $al_field9 = (string) get_parameter_post ("field9_value"); $al_field10 = (string) get_parameter_post ("al_field10"); + $al_field11 = (string) get_parameter_post ("field11_value"); + $al_field12 = (string) get_parameter_post ("field12_value"); + $al_field13 = (string) get_parameter_post ("field13_value"); + $al_field14 = (string) get_parameter_post ("field14_value"); + $al_field15 = (string) get_parameter_post ("field15_value"); $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); @@ -168,6 +178,11 @@ if ($save_alert || $modify_alert) { 'al_field8' => $al_field8, 'al_field9' => $al_field9, 'al_field10' => $al_field10, + 'al_field11' => $al_field11, + 'al_field12' => $al_field12, + 'al_field13' => $al_field13, + 'al_field14' => $al_field14, + 'al_field15' => $al_field15, 'description' => $description, 'agent' => $source_ip, 'custom_oid' => $custom_value, @@ -239,6 +254,8 @@ if ($save_alert || $modify_alert) { al_field2 = '%s', al_field3 = '%s', al_field4 = '%s', al_field5 = '%s', al_field6 = '%s',al_field7 = '%s', al_field8 = '%s', al_field9 = '%s',al_field10 = '%s', + al_field11 = '%s', al_field12 = '%s', al_field13 = '%s', + al_field14 = '%s', al_field15 = '%s', description = '%s', agent = '%s', custom_oid = '%s', oid = '%s', time_threshold = %d, max_alerts = %d, min_alerts = %d, @@ -274,7 +291,8 @@ if ($save_alert || $modify_alert) { WHERE id_as = %d", $priority, $alert_type, $al_field1, $al_field2, $al_field3, $al_field4, $al_field5, $al_field6, $al_field7, $al_field8, - $al_field9, $al_field10, + $al_field9, $al_field10, $al_field11, $al_field12, $al_field13, + $al_field14, $al_field15, $description, $source_ip, $custom_value, $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, @@ -329,6 +347,11 @@ if ($update_alert || $duplicate_alert) { $al_field8 = $alert["al_field8"]; $al_field9 = $alert["al_field9"]; $al_field10 = $alert["al_field10"]; + $al_field11 = $alert["al_field11"]; + $al_field12 = $alert["al_field12"]; + $al_field13 = $alert["al_field13"]; + $al_field14 = $alert["al_field14"]; + $al_field15 = $alert["al_field15"]; $max_alerts = $alert["max_alerts"]; $min_alerts = $alert["min_alerts"]; $priority = $alert["priority"]; @@ -396,6 +419,11 @@ elseif ($create_alert) { $al_field8 = ""; $al_field9 = ""; $al_field10 = ""; + $al_field11 = ""; + $al_field12 = ""; + $al_field13 = ""; + $al_field14 = ""; + $al_field15 = ""; $max_alerts = 1; $min_alerts = 0; $priority = 0; @@ -450,8 +478,9 @@ if($duplicate_alert){ $sql = sprintf ("insert into talert_snmp ( id_alert, al_field1, al_field2, al_field3, al_field4, al_field5, al_field6, al_field7, - al_field8, al_field9, al_field10, description, - agent, custom_oid, oid, time_threshold, + al_field8, al_field9, al_field10, al_field11, + al_field12, al_field13, al_field14, al_field15, + description, agent, custom_oid, oid, time_threshold, times_fired, last_fired, max_alerts, min_alerts, internal_counter, priority, ".db_escape_key_identifier('_snmp_f1_') .", @@ -486,6 +515,7 @@ if($duplicate_alert){ '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", $id_alert, $al_field1, $al_field2, $al_field3, $al_field4, $al_field5, $al_field6, $al_field7, $al_field8, $al_field9, $al_field10, + $al_field11, $al_field12, $al_field13, $al_field14, $al_field15, $description, $source_ip, $custom_value, $oid, $time_threshold, $times_fired, $last_fired, $max_alerts, $min_alerts, $internal_counter, $priority, $custom_oid_data_1, $custom_oid_data_2, $custom_oid_data_3, @@ -860,12 +890,17 @@ if ($create_alert || $update_alert) { 'al_field7' => $al_field7, 'al_field8' => $al_field8, 'al_field9' => $al_field9, - 'al_field10' => $al_field10); + 'al_field10' => $al_field10, + 'al_field11' => $al_field11, + 'al_field12' => $al_field12, + 'al_field13' => $al_field13, + 'al_field14' => $al_field14, + 'al_field15' => $al_field15); // Hidden div with help hint to fill with javascript html_print_div(array('id' => 'help_snmp_alert_hint', 'content' => ui_print_help_icon ("snmp_alert_field1", true), 'hidden' => true)); - for ($i = 1; $i <= 10; $i++) { + for ($i = 1; $i <= $config['max_macro_fields']; $i++) { echo '