2012-09-10 Vanessa Gil <vanessa.gil@artica.es>

* pandoradb.sql
	  pandoradb.postgreSQL.sql
	  pandoradb.oracle.sql
	  extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql
	  extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql
	  extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql
	  godmode/agentes/configurar_agente.php
	  godmode/agentes/module_manager_editor.php
	  godmode/agentes/module_manager_editor_common.php
	  godmode/modules/manage_network_components.php
	  godmode/modules/manage_network_components_form.php
	  godmode/modules/manage_network_components_form_common.php
	  include/functions_alerts.php
	  include/functions_events.php
	  operation/events/events_list.php: Added several fields to modules
	and events.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6948 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
vgilc 2012-09-10 16:00:14 +00:00
parent 9087beb4de
commit ed20d818ee
16 changed files with 205 additions and 15 deletions

View File

@ -1,3 +1,22 @@
2012-09-10 Vanessa Gil <vanessa.gil@artica.es>
* pandoradb.sql
pandoradb.postgreSQL.sql
pandoradb.oracle.sql
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql
godmode/agentes/configurar_agente.php
godmode/agentes/module_manager_editor.php
godmode/agentes/module_manager_editor_common.php
godmode/modules/manage_network_components.php
godmode/modules/manage_network_components_form.php
godmode/modules/manage_network_components_form_common.php
include/functions_alerts.php
include/functions_events.php
operation/events/events_list.php: Added several fields to modules
and events.
2012-09-07 Miguel de Dios <miguel.dedios@artica.es>
* include/javascript/pandora.js, include/functions_ui.php,

View File

@ -305,3 +305,18 @@ ALTER TABLE trecon_task MODIFY field1 TEXT NOT NULL DEFAULT '';
-- Table `tlayout_data
-- -----------------------------------------------------
ALTER TABLE tlayout_data ADD COLUMN `enable_link` tinyint(1) UNSIGNED NOT NULL default 1;
-- -----------------------------------------------------
-- Table `tlocal_component`
-- -----------------------------------------------------
ALTER TABLE tlocal_component ADD `critical_instructions` TEXT NOT NULL default '';
ALTER TABLE tlocal_component ADD `warning_instructions` TEXT NOT NULL default '';
ALTER TABLE tlocal_component ADD `unknown_instructions` TEXT NOT NULL default '';
-- -----------------------------------------------------
-- Table `tpolicy_modules`
-- -----------------------------------------------------
ALTER TABLE tpolicy_modules ADD `critical_instructions` TEXT NOT NULL default '';
ALTER TABLE tpolicy_modules ADD `warning_instructions` TEXT NOT NULL default '';
ALTER TABLE tpolicy_modules ADD `unknown_instructions` TEXT NOT NULL default '';

View File

@ -304,3 +304,18 @@ ALTER TABLE trecon_task MODIFY field1 TEXT NOT NULL;
-- Table `tlayout_data`
-- -----------------------------------------------------
ALTER TABLE tlayout_data ADD (enable_link NUMBER(5, 0) NOT NULL default 1);
-- -----------------------------------------------------
-- Table `tlocal_component`
-- -----------------------------------------------------
ALTER TABLE tlocal_component ADD (critical_instructions VARCHAR2(255) default '');
ALTER TABLE tlocal_component ADD (warning_instructions VARCHAR2(255) default '');
ALTER TABLE tlocal_component ADD (unknown_instructions VARCHAR2(255) default '');
-- -----------------------------------------------------
-- Table `tpolicy_modules`
-- -----------------------------------------------------
ALTER TABLE tpolicy_modules ADD (critical_instructions VARCHAR2(255) default '');
ALTER TABLE tpolicy_modules ADD (warning_instructions VARCHAR2(255) default '');
ALTER TABLE tpolicy_modules ADD (unknown_instructions VARCHAR2(255) default '');

View File

@ -305,3 +305,17 @@ ALTER TABLE "trecon_task" ALTER COLUMN "field1" TYPE TEXT;
-- Table `tlayout_data`
-- -----------------------------------------------------
ALTER TABLE "tlayout_data" ADD COLUMN "enable_link" SMALLINT NOT NULL default 1;
-- -----------------------------------------------------
-- Table `tlocal_component`
-- -----------------------------------------------------
ALTER TABLE "tlocal_component" ADD COLUMN "critical_instructions" text default '';
ALTER TABLE "tlocal_component" ADD COLUMN "warning_instructions" text default '';
ALTER TABLE "tlocal_component" ADD COLUMN "unknown_instructions" text default '';
-- -----------------------------------------------------
-- Table `tpolicy_modules`
-- -----------------------------------------------------
ALTER TABLE "tpolicy_modules" ADD COLUMN "critical_instructions" text default '';
ALTER TABLE "tpolicy_modules" ADD COLUMN "warning_instructions" text default '';
ALTER TABLE "tpolicy_modules" ADD COLUMN "unknown_instructions" text default '';

View File

@ -781,6 +781,9 @@ if ($update_module || $create_module) {
$unit = (string) get_parameter('unit');
$id_tag = (array) get_parameter('id_tag_selected');
$serialize_ops = (string) get_parameter('serialize_ops');
$critical_instructions = (string) get_parameter('critical_instructions');
$warning_instructions = (string) get_parameter('warning_instructions');
$unknown_instructions = (string) get_parameter('unknown_instructions');
if ($prediction_module != 3) {
unset($serialize_ops);
@ -840,8 +843,10 @@ if ($update_module) {
'custom_integer_2' => $custom_integer_2,
'min_ff_event' => $ff_event,
'unit' => $unit,
'macros' => $macros,
'quiet' => $quiet_module);
'quiet' => $quiet_module,
'critical_instructions' => $critical_instructions,
'warning_instructions' => $warning_instructions,
'unknown_instructions' => $unknown_instructions);
if ($prediction_module == 3 && $serialize_ops == '') {
$result = false;
@ -950,7 +955,10 @@ if ($create_module) {
'min_ff_event' => $ff_event,
'unit' => $unit,
'macros' => $macros,
'quiet' => $quiet_module);
'quiet' => $quiet_module,
'critical_instructions' => $critical_instructions,
'warning_instructions' => $warning_instructions,
'unknown_instructions' => $unknown_instructions);
if ($prediction_module == 3 && $serialize_ops == '') {
$id_agent_module = false;

View File

@ -201,6 +201,11 @@ if ($id_agent_module) {
$ff_event = $module['min_ff_event'];
// Select tag info.
$id_tag = tags_get_module_tags ($id_agent_module);
$critical_instructions = $module['critical_instructions'];
$warning_instructions = $module['warning_instructions'];
$unknown_instructions = $module['unknown_instructions'];
}
else {
if (!isset ($moduletype)) {
@ -253,6 +258,11 @@ else {
$snmp3_privacy_method = "";
$snmp3_privacy_pass = "";
$snmp3_security_level = "";
$critical_instructions = '';
$warning_instructions = '';
$unknown_instructions = '';
}
}

View File

@ -122,6 +122,10 @@ $table_simple->style[0] = 'font-weight: bold; vertical-align: top; width: 26%';
$table_simple->style[1] = 'width: 40%';
$table_simple->style[2] = 'font-weight: bold; vertical-align: top';
$table_simple->colspan[4][1] = 3;
$table_simple->colspan[5][1] = 3;
$table_simple->colspan[6][1] = 3;
$table_simple->data[0][0] = __('Name');
$table_simple->data[0][1] = html_print_input_text ('name', io_safe_output($name), '', 45, 100, true, $disabledBecauseInPolicy);
@ -250,6 +254,16 @@ else {
$table_simple->data[3][3] = html_print_checkbox ("history_data", 1, $history_data, true, $disabledBecauseInPolicy);
}
$table_simple->data[4][0] = __('Critical instructions');
$table_simple->data[4][1] = html_print_textarea ('critical_instructions', 2, 65, $critical_instructions, '', true);
$table_simple->data[5][0] = __('Warning instructions');
$table_simple->data[5][1] = html_print_textarea ('warning_instructions', 2, 65, $warning_instructions, '', true);
$table_simple->data[6][0] = __('Unknown instructions');
$table_simple->data[6][1] = html_print_textarea ('unknown_instructions', 2, 65, $unknown_instructions, '', true);
/* Advanced form part */
$table_advanced->id = 'advanced';
$table_advanced->width = '98%';

View File

@ -75,6 +75,9 @@ $unit = (string) get_parameter('unit');
$id = (int) get_parameter ('id');
$wizard_level = get_parameter ('wizard_level');
$only_metaconsole = get_parameter ('only_metaconsole');
$critical_instructions = (string) get_parameter('critical_instructions');
$warning_instructions = (string) get_parameter('warning_instructions');
$unknown_instructions = (string) get_parameter('unknown_instructions');
$snmp_version = (string) get_parameter('snmp_version');
$snmp3_auth_user = (string) get_parameter('snmp3_auth_user');
@ -110,6 +113,7 @@ if ($duplicate_network_component) {
}
if ($create_component) {
$custom_string_1 = '';
$custom_string_2 = '';
$custom_string_3 = '';
@ -160,7 +164,10 @@ if ($create_component) {
'unit' => $unit,
'wizard_level' => $wizard_level,
'only_metaconsole' => $only_metaconsole,
'macros' => $macros));
'macros' => $macros,
'critical_instructions' => $critical_instructions,
'warning_instructions' => $warning_instructions,
'unknown_instructions' => $unknown_instructions));
}
else {
$id = '';
@ -232,7 +239,10 @@ if ($update_component) {
'unit' => $unit,
'wizard_level' => $wizard_level,
'only_metaconsole' => $only_metaconsole,
'macros' => $macros));
'macros' => $macros,
'critical_instructions' => $critical_instructions,
'warning_instructions' => $warning_instructions,
'unknown_instructions' => $unknown_instructions));
}
else {
$result = '';
@ -342,7 +352,10 @@ $url = ui_get_url_refresh (array ('offset' => false,
'max_critical' => false,
'str_critical' => false,
'ff_event' => false,
'id_component_type' => false));
'id_component_type' => false,
'critical_instructions' => false,
'warning_instructions' => false,
'unknown_instructions' => false));
$search_id_group = (int) get_parameter ('search_id_group');

View File

@ -60,6 +60,9 @@ if ($create_network_from_module) {
$post_process = $data_module["post_process"];
$unit = $data_module["unit"];
$wizard_level = $data_module["wizard_level"];
$critical_instructions = $data_module["critical_instructions"];
$warning_instructions = $data_module["warning_instructions"];
$unknown_instructions = $data_module["unknown_instructions"];
}
@ -103,6 +106,9 @@ if (isset ($id)) {
$unit = $component["unit"];
$wizard_level = $component["wizard_level"];
$only_metaconsole = $component["only_metaconsole"];
$critical_instructions = $component["critical_instructions"];
$warning_instructions = $component["warning_instructions"];
$unknown_instructions = $component["unknown_instructions"];
if ($type >= 15 && $type <= 18) {
@ -145,6 +151,9 @@ if (isset ($id)) {
$unit = '';
$wizard_level = 'nowizard';
$only_metaconsole = 0;
$critical_instructions = '';
$warning_instructions = '';
$unknown_instructions = '';
$snmp_version = 1;
$snmp3_auth_user = '';

View File

@ -44,6 +44,9 @@ $table->colspan = array ();
if(!enterprise_installed()) {
$table->colspan[0][1] = 3;
}
$table_simple->colspan[7][1] = 4;
$table_simple->colspan[8][1] = 4;
$table_simple->colspan[9][1] = 4;
$table->data = array ();
$table->data[0][0] = __('Name');
@ -114,4 +117,16 @@ $table->data[5][3] = html_print_input_text ('max', $max, '', 5, 15, true);
$table->data[6][0] = __('Unit');
$table->data[6][1] = html_print_input_text ('unit', $unit, '', 12, 25, true);
$table->data[6][2] = $table->data[6][3] = '';
$table->data[7][0] = __('Critical instructions');
$table->data[7][1] = html_print_textarea ('critical_instructions', 2, 65, $critical_instructions, '', true);
$table->data[7][2] = $table->data[7][3] = '';
$table->data[8][0] = __('Warning instructions');
$table->data[8][1] = html_print_textarea ('warning_instructions', 2, 65, $warning_instructions, '', true);
$table->data[8][2] = $table->data[8][3] = '';
$table->data[9][0] = __('Unknown instructions');
$table->data[9][1] = html_print_textarea ('unknown_instructions', 2, 65, $unknown_instructions, '', true);
$table->data[9][2] = $table->data[9][3] = '';
?>

View File

@ -1164,6 +1164,9 @@ function alerts_validate_alert_agent_module ($id_alert_agent_module, $noACLs = f
$alert = alerts_get_alert_agent_module ($id);
$agent_id = modules_get_agentmodule_agent ($alert["id_agent_module"]);
$group_id = agents_get_agentmodule_group ($agent_id);
$critical_instructions = db_get_value('critical_instructions', 'tagente_modulo', 'id_agente_modulo', $agent_id);
$warning_instructions = db_get_value('warning_instructions', 'tagente_modulo', 'id_agente_modulo', $agent_id);
$unknown_instructions = db_get_value('unknown_instructions', 'tagente_modulo', 'id_agente_modulo', $agent_id);
if (!$noACLs){
if (! check_acl ($config['id_user'], $group_id, "AW")) {
@ -1180,7 +1183,7 @@ function alerts_validate_alert_agent_module ($id_alert_agent_module, $noACLs = f
alerts_get_alert_template_description ($alert["id_alert_template"]),
$group_id, $agent_id, 1, $config["id_user"],
"alert_manual_validation", 1, $alert["id_agent_module"],
$id);
$id, $critical_instructions, $warning_instructions, $unknown_instructions);
}
elseif ($result === false) {
return false;

View File

@ -268,17 +268,17 @@ function events_get_description ($id_event) {
*
* @return int event id
*/
function events_create_event ($event, $id_group, $id_agent, $status = 0, $id_user = "", $event_type = "unknown", $priority = 0, $id_agent_module = 0, $id_aam = 0) {
function events_create_event ($event, $id_group, $id_agent, $status = 0, $id_user = "", $event_type = "unknown", $priority = 0, $id_agent_module = 0, $id_aam = 0, $critical_instructions = '', $warning_instructions = '', $unknown_instructions = '') {
global $config;
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf ('INSERT INTO tevento (id_agente, id_grupo, evento, timestamp,
estado, utimestamp, id_usuario, event_type, criticity,
id_agentmodule, id_alert_am)
id_agentmodule, id_alert_am, critical_instructions, warning_instructions, unknown_instructions)
VALUES (%d, %d, "%s", NOW(), %d, UNIX_TIMESTAMP(NOW()), "%s", "%s", %d, %d, %d)',
$id_agent, $id_group, $event, $status, $id_user, $event_type,
$priority, $id_agent_module, $id_aam);
$priority, $id_agent_module, $id_aam, $critical_instructions, $warning_instructions, $unknown_instructions);
break;
case "postgresql":
$sql = sprintf ('INSERT INTO tevento (id_agente, id_grupo, evento, timestamp,

View File

@ -1111,6 +1111,40 @@ foreach ($result as $event) {
}
$string .= '</td></tr><tr>';
$string .= '<tr class="' . $odd . '"><td align="left" valign="top">' . '<b>' . __('Critical instructions') . '</td><td align="left">';
if ($event["critical_instructions"] != '') {
$string .= $event["critical_instructions"];
$string .= '</td></tr><tr>';
$odd = ($odd == '')? 'rowOdd' : '';
}
else {
$string .= '<i>- ' . __('Empty') . ' -</i>';
}
$string .= '</td></tr>';
$string .= '<tr class="' . $odd . '"><td align="left" valign="top">' . '<b>' . __('Warning instructions') . '</td><td align="left">';
if ($event["warning_instructions"] != '') {
$string .= $event["warning_instructions"];
$string .= '</td></tr><tr>';
$odd = ($odd == '')? 'rowOdd' : '';
}
else {
$string .= '<i>- ' . __('Empty') . ' -</i>';
}
$string .= '</td></tr>';
$string .= '<tr class="' . $odd . '"><td align="left" valign="top">' . '<b>' . __('Unknown instructions') . '</td><td align="left">';
if ($event["unknown_instructions"] != '') {
$string .= $event["unknown_instructions"];
$string .= '</td></tr><tr>';
$odd = ($odd == '')? 'rowOdd' : '';
}
else {
$string .= '<i>- ' . __('Empty') . ' -</i>';
}
$string .= '</td></tr>';
$string .= '</table>';
$data = array($string);

View File

@ -229,6 +229,9 @@ CREATE TABLE tagente_modulo (
warning_instructions CLOB default '',
unknown_instructions CLOB default '',
quiet NUMBER(5, 0) default 0 NOT NULL,
critical_instructions VARCHAR2(255) default '',
warning_instructions VARCHAR2(255) default '',
unknown_instructions VARCHAR2(255) default '',
CONSTRAINT t_agente_modulo_wizard_level_cons CHECK (wizard_level IN ('basic','advanced','custom','nowizard'))
);
CREATE INDEX tagente_modulo_id_agente_idx ON tagente_modulo(id_agente);
@ -536,6 +539,9 @@ CREATE TABLE tevento (
tags CLOB,
source VARCHAR2(100) default '' NOT NULL,
id_extra VARCHAR2(100) default '' NOT NULL,
critical_instructions VARCHAR2(255) default '',
warning_instructions VARCHAR2(255) default '',
unknown_instructions VARCHAR2(255) default '',
CONSTRAINT tevento_event_type_cons CHECK (event_type IN ('unknown','alert_fired','alert_recovered','alert_ceased','alert_manual_validation','recon_host_detected','system','error','new_agent','going_up_warning','going_up_critical','going_down_warning','going_down_normal','going_down_critical','going_up_normal', 'configuration_change'))
);
CREATE INDEX tevento_id_1_idx ON tevento(id_agente, id_evento);
@ -672,6 +678,9 @@ CREATE TABLE tnetwork_component (
wizard_level VARCHAR2(100) default 'nowizard' NOT NULL,
only_metaconsole NUMBER(5, 0) default 0 NOT NULL,
macros CLOB default '',
critical_instructions VARCHAR2(255) default '',
warning_instructions VARCHAR2(255) default '',
unknown_instructions VARCHAR2(255) default '',
CONSTRAINT t_network_component_wizard_level_cons CHECK (wizard_level IN ('basic','advanced','custom','nowizard'))
);

View File

@ -439,7 +439,10 @@ CREATE TABLE "tevento" (
"user_comment" text NOT NULL,
"tags" text NOT NULL,
"source" text NOT NULL default '',
"id_extra" text NOT NULL default ''
"id_extra" text NOT NULL default '',
"critical_instructions" TEXT default '',
"warning_instructions" TEXT default '',
"unknown_instructions" TEXT default ''
);
CREATE INDEX "tevento_id_1_idx" ON "tevento"("id_agente", "id_evento");
CREATE INDEX "tevento_id_2_idx" ON "tevento"("utimestamp", "id_evento");
@ -551,7 +554,10 @@ CREATE TABLE "tnetwork_component" (
"unit" TEXT default '',
"wizard_level" type_tlocal_component_wizard_level default 'nowizard',
"only_metaconsole" INTEGER default '0',
"macros" TEXT default ''
"macros" TEXT default '',
"critical_instructions" TEXT default '',
"warning_instructions" TEXT default '',
"unknown_instructions" TEXT default ''
);
CREATE TABLE "tnetwork_component_group" (

View File

@ -217,9 +217,9 @@ CREATE TABLE IF NOT EXISTS `tagente_modulo` (
`custom_integer_2` int(10) default 0,
`wizard_level` enum('basic','advanced','custom','nowizard') default 'nowizard',
`macros` text,
`critical_instructions` text,
`warning_instructions` text,
`unknown_instructions` text,
`critical_instructions` text NOT NULL default '',
`warning_instructions` text NOT NULL default '',
`unknown_instructions` text NOT NULL default '',
`quiet` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id_agente_modulo`),
KEY `main_idx` (`id_agente_modulo`,`id_agente`),
@ -518,6 +518,9 @@ CREATE TABLE IF NOT EXISTS `tevento` (
`tags` text NOT NULL,
`source` tinytext NOT NULL,
`id_extra` tinytext NOT NULL,
`critical_instructions` text NOT NULL default '',
`warning_instructions` text NOT NULL default '',
`unknown_instructions` text NOT NULL default '',
PRIMARY KEY (`id_evento`),
KEY `indice_1` (`id_agente`,`id_evento`),
KEY `indice_2` (`utimestamp`,`id_evento`),
@ -653,6 +656,9 @@ CREATE TABLE IF NOT EXISTS `tnetwork_component` (
`wizard_level` enum('basic','advanced','custom','nowizard') default 'nowizard',
`only_metaconsole` tinyint(1) unsigned default '0',
`macros` text,
`critical_instructions` text NOT NULL default '',
`warning_instructions` text NOT NULL default '',
`unknown_instructions` text NOT NULL default '',
PRIMARY KEY (`id_nc`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;