diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index a3ee5ef2f9..0251dd99f0 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,20 @@ +2012-02-20 Vanessa Gil + * pandoradb.sql + pandoradb.oracle.sql + pandoradb.postgreSQL.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 + 'tgraph_template' and 'tgraph_source_template' tables. + + * godmode/reporting/graphs.php + include/functions_reporting.php: Added templates for combined + graphs. + + * godmode/reporting/graph_template_editor.php + godmode/reporting/graph_template_item_editor.php + godmode/reporting/graph_template_list.php: Added files. + 2012-02-16 Vanessa Gil * operation/events/events_list: Changed extended info to event list. 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 64162582c4..22a963687d 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 @@ -158,3 +158,35 @@ INSERT INTO tconfig (token, `value`) SELECT 'list_ACL_IPs_for_API', GROUP_CONCAT INSERT INTO `tconfig` (`token`, `value`) VALUES ('event_fields', 'evento,id_agente,estado,timestamp'); DELETE FROM tconfig WHERE token LIKE "list_ACL_IPs_for_API_%"; +-- ----------------------------------------------------- +-- Table `tgraph_template` +-- ----------------------------------------------------- + +CREATE TABLE IF NOT EXISTS `tgraph_template` ( + `id_graph_template` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `id_user` TEXT NOT NULL, + `name` TEXT NOT NULL, + `description` TEXT NOT NULL, + `period` int(11) NOT NULL default '0', + `width` smallint(5) UNSIGNED NOT NULL DEFAULT 0, + `height` smallint(5) UNSIGNED NOT NULL DEFAULT 0, + `private` tinyint(1) UNSIGNED NOT NULL default 0, + `events` tinyint(1) UNSIGNED NOT NULL default 0, + `stacked` tinyint(1) UNSIGNED NOT NULL default 0, + `id_group` mediumint(8) unsigned NULL default 0, + PRIMARY KEY(`id_graph_template`) +) ENGINE = InnoDB DEFAULT CHARSET=utf8; + +-- ----------------------------------------------------- +-- Table `tgraph_source_template` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tgraph_source_template` ( + `id_gs_template` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `id_template` int(11) NOT NULL default 0, + `agent` TEXT, + `module` TEXT, + `weight` FLOAT(5,3) NOT NULL DEFAULT 2, + `exact_match` tinyint(1) default 0, + PRIMARY KEY(`id_gs_template`) +) ENGINE = InnoDB DEFAULT CHARSET=utf8; + 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 14b2df8941..cb0fac6f48 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 @@ -148,3 +148,37 @@ CREATE TABLE tevent_filter ( -- ----------------------------------------------------- ALTER TABLE tconfig MODIFY value TEXT NOT NULL; INSERT INTO tconfig (token, value) VALUES ('event_fields', 'evento,id_agente,estado,timestamp'); + +-- ----------------------------------------------------- +-- Table `tgraph_template` +-- ----------------------------------------------------- + +CREATE TABLE tgraph_template ( + id_graph_template NUMBER(10, 0) NOT NULL PRIMARY KEY, + id_user VARCHAR2(255) NOT NULL, + name VARCHAR2(255) NOT NULL, + description CLOB default '', + period NUMBER(11, 0) default 0 NOT NULL, + width SMALLINT default 0 NOT NULL, + height SMALLINT default 0 NOT NULL, + private SMALLINT default 0 NOT NULL, + events SMALLINT default 0 NOT NULL, + stacked SMALLINT default 0 NOT NULL, + id_group NUMBER(8, 0) default 0 +); + +CREATE SEQUENCE tgraph_template_s INCREMENT BY 1 START WITH 1; + +-- ----------------------------------------------------- +-- Table `tgraph_source_template` +-- ----------------------------------------------------- +CREATE tgraph_source_template ( + id_gs_template NUMBER(10, 0) NOT NULL PRIMARY KEY, + id_template NUMBER(10, 0) default 0 NOT NULL, + agent VARCHAR2(255), + module VARCHAR2(255), + weight FLOAT(5) DEFAULT 2 NOT NULL; + exact_match SMALLINT default 0 NOT NULL +); + +CREATE SEQUENCE tgraph_source_template_s INCREMENT BY 1 START WITH 1; 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 e080803b7d..42ea49a799 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 @@ -135,3 +135,35 @@ ALTER TABLE "tconfig" ALTER COLUMN "value" TYPE TEXT; INSERT INTO tconfig ("token", "value") SELECT 'list_ACL_IPs_for_API', array_to_string(ARRAY(SELECT value FROM tconfig WHERE token LIKE 'list_ACL_IPs_for_API%'), ';') AS "value"; INSERT INTO "tconfig" ("token", "value") VALUES ('event_fields', 'evento,id_agente,estado,timestamp'); + +-- ----------------------------------------------------- +-- Table `tgraph_template` +-- ----------------------------------------------------- + +CREATE TABLE IF NOT EXISTS "tgraph_template" ( + "id_graph_template" SERIAL NOT NULL PRIMARY KEY, + "id_user" TEXT NOT NULL default '', + "name" TEXT NOT NULL default '', + "description" TEXT NOT NULL default '', + "period" INTEGER NOT NULL default 0, + "width" SMALLINT NOT NULL default 0, + "height" SMALLINT NOT NULL default 0, + "private" SMALLINT NOT NULL default 0, + "events" SMALLINT NOT NULL default 0, + "stacked" SMALLINT NOT NULL default 0, + "id_group" INTEGER NOT NULL default 0 + ); + + -- ----------------------------------------------------- +-- Table `tgraph_source_template` +-- ----------------------------------------------------- + +CREATE TABLE IF NOT EXISTS "tgraph_source_template" ( + "id_gs_template" SERIAL NOT NULL PRIMARY KEY, + "id_template" INTEGER NOT NULL default 0, + "agent" TEXT NOT NULL default '', + "module" TEXT NOT NULL default '', + "period" INTEGER NOT NULL default 0, + "weight" DOUBLE PRECISION default 2.0, + "exact_match" SMALLINT NOT NULL default 0 + ); diff --git a/pandora_console/godmode/reporting/graph_template_editor.php b/pandora_console/godmode/reporting/graph_template_editor.php new file mode 100644 index 0000000000..c14e4e64a1 --- /dev/null +++ b/pandora_console/godmode/reporting/graph_template_editor.php @@ -0,0 +1,217 @@ + $name, + 'id_user' => $config['id_user'], + 'period' => $period, + 'width' => $width, + 'height' => $height, + 'id_group' => $id_group, + 'stacked' => $stacked, + 'private' => 0, + 'events' => $events, + 'description' => $description + ); + $id_template = db_process_sql_insert('tgraph_template', $values); +} + +$buttons['graph_list'] = '' + . html_print_image ("images/god6.png", true, array ("title" => __('Template list'))) + . ''; + +$buttons['template_editor'] = '' + . html_print_image ("images/config.png", true, array ("title" => __('Template editor'))) + . ''; + +// Header +ui_print_page_header (__('Graph template editor'), "", false, "", true, $buttons); + +if ($create) { + if ($id_template === false) { + ui_print_error_message ('Error creating template'); + } else { + ui_print_success_message ('Template created successfully'); + } +} + +if ($id_template) { + $template_data = db_get_row_sql("SELECT * FROM tgraph_template WHERE id_graph_template = " . $id_template); + $stacked = $template_data['stacked']; + $events = $template_data['events']; + $period = $template_data['period']; + $name = $template_data['name']; + $description = $template_data['description']; + $id_group = $template_data['id_group']; + $width = $template_data['width']; + $height = $template_data['height']; +} else { + $id_agent = 0; + $id_module = 0; + $id_group = 0; + $name = ""; + $description = ""; + $width = 550; + $height = 210; + $period = 86400; + $events = 0; + $factor = 1; + $stacked = 0; +} + +if ($update) { + $stacked = get_parameter('stacked'); + $events = get_parameter('events'); + $period = get_parameter('period'); + $name = get_parameter('name'); + $description = get_parameter('description'); + $id_group = get_parameter('id_group'); + $width = get_parameter('width'); + $height = get_parameter('height'); + + if ($name == '') { + ui_print_error_message (__('Not updated. Blank name')); + } else { + $result = db_process_sql_update ('tgraph_template', + array ( + 'name' => $name, + 'period' => $period, + 'width' => $width, + 'height' => $height, + 'id_group' => $id_group, + 'stacked' => $stacked, + 'events' => $events, + 'description' => $description + ), + array ('id_graph_template' => $id_template)); + ui_print_result_message ($result, __('Template updated successfully'), __('Error updating template')); + } +} + +// ----------------------- +// CREATE/EDIT GRAPH TEMPLATE FORM +// ----------------------- + +echo ""; + +if ($id_template) + echo ""; +else + echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +$periods = array(3600 => "1 ".__('hour'), 7200 => "2 ".__('hours'), 10800 => "3 ".__('hours'), + 21600 => "6 ".__('hours'), 43200 => "12 ".__('hours'), 86400 => "1 ".__('day'), + 172800 => "2 ".__('days'), 345600 => "4 ".__('days'), 604800 => __('Last week'), + 1296000 => "15 ".__('days'), 2592000 => __('Last month'), 5184000 => "2 ".__('months'), + 15552000 => "6 ".__('months'), 31104000 => __('1 year'), 31104000 => __('1 year')); + +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; + +echo ""; + +echo ""; +echo "
".__('Name').""; + +$own_info = get_user_info ($config['id_user']); +if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) + $return_all_groups = true; +else + $return_all_groups = false; + +echo "".__('Group')."" . + html_print_select_groups($config['id_user'], "AR", $return_all_groups, 'graph_id_group', $id_group, '', '', '', true) . + "
".__('Description').""; +echo "
"; +echo "".__('Width').""; +echo ""; +echo "".__('Height').""; +echo "
"; +echo "".__('Period').""; +html_print_select ($periods, 'period', $period); +echo ""; +echo "".__('Stacked').""; + +include_once($config["homedir"] . "/include/functions_graph.php"); + +$stackeds = array( + GRAPH_AREA => __('Area'), + GRAPH_STACKED_AREA => __('Stacked area'), + GRAPH_LINE => __('Line'), + GRAPH_STACKED_LINE => __('Stacked line')); +html_print_select ($stackeds, 'stacked', $stacked); +echo "
"; +echo "".__('View events').""; +html_print_checkbox('events', 1, $events); +echo "
"; +if ($id_template) { + echo ""; +} +else { + echo ""; +} +echo "
"; +echo ""; diff --git a/pandora_console/godmode/reporting/graph_template_item_editor.php b/pandora_console/godmode/reporting/graph_template_item_editor.php new file mode 100644 index 0000000000..4a0fa57b59 --- /dev/null +++ b/pandora_console/godmode/reporting/graph_template_item_editor.php @@ -0,0 +1,151 @@ +' + . html_print_image ("images/god6.png", true, array ("title" => __('Template list'))) + . ''; +// Header +ui_print_page_header (__('Graph template editor'), "", false, "", true, $buttons); + +if ($create) { + if (!$id_template) { + ui_print_error_message ('Not created. Blank template.'); + } else { + $agent = get_parameter('agent', ''); + $module = get_parameter('module', ''); + $match = get_parameter('match', 0); + $weight = get_parameter('weight', 1); + + if ($module != '') { + $values = array ( + 'id_template' => $id_template, + 'agent' => $agent, + 'module' => $module, + 'exact_match' => $match, + 'weight' => $weight + ); + $id_gs_template = db_process_sql_insert('tgraph_source_template', $values); + if ($id_gs_template === false) { + ui_print_error_message ('Error creating template'); + } else { + ui_print_success_message ('Template created successfully'); + } + } else { + ui_print_error_message ('Not created. Blank module'); + } + } +} + +if ($delete) { + $id_gs_template = get_parameter('id_gs_template'); + $id_template = get_parameter('id_template'); + + $result = db_process_sql_delete ('tgraph_source_template', + array ('id_gs_template' => $id_gs_template)); + + if ($result !== false) { + $result = true; + } else { + $result = false; + } + + ui_print_result_message ($result, + __('Successfully deleted'), + __('Not deleted. Error deleting data')); +} + +if ($id_template) { + $sql = "SELECT * FROM tgraph_source_template where id_template=$id_template"; + $templates = db_get_all_rows_sql($sql); + if ($templates != false) { + $table_aux->width = '90%'; + + $table_aux->size = array(); + $table_aux->size[0] = '40%'; + $table_aux->size[1] = '30%'; + $table_aux->size[2] = '20%'; + $table_aux->size[3] = '30px'; + + $table_aux->head[0] = __('Agent'); + $table_aux->align[0] = 'center'; + $table_aux->head[1] = __('Module'); + $table_aux->align[1] = 'center'; + $table_aux->head[2] = __('Weight'); + $table_aux->align[2] = 'center'; + $table_aux->head[3] = __('Delete'); + $table_aux->align[3] = 'center'; + + $table_aux->data = array(); + + foreach ($templates as $template) { + $data = array(); + + $data[0] = $template['agent']; + $data[1] = $template['module']; + $data[2] = $template['weight']; + $data[3] = "" . + html_print_image('images/cross.png', true, array('title' => __('Delete'))) . ""; + + array_push ($table_aux->data, $data); + } + + html_print_table($table_aux); + } +} + +//Configuration form +$table->width = '90%'; + +$table->size = array(); +$table->size[0] = '40%'; +$table->size[1] = '40%'; + +$table->data = array(); + +$table->data[0][0] = ''.__('Agent').''; +$table->data[1][0] = html_print_input_text('agent', '', '', 30, 255, true); +$table->data[0][1] = ''.__('Module').''; +$table->data[1][1] = html_print_input_text('module', '', '', 30, 255, true); +$table->data[2][0] = ''.__('Weight').''; +$table->data[2][0] .= '    '.html_print_input_text('weight', 2, '', 3, 5, true); +$table->data[2][1] = __('Exact match'); +$table->data[2][1] .= html_print_checkbox('match', 1, 0, true); + +echo '
'; +html_print_table($table); +echo '
'; + +html_print_submit_button (__('Add'), 'crt', false, 'class="sub add"'); + +echo '
'; +echo '
'; +?> diff --git a/pandora_console/godmode/reporting/graph_template_list.php b/pandora_console/godmode/reporting/graph_template_list.php new file mode 100644 index 0000000000..05725c4cff --- /dev/null +++ b/pandora_console/godmode/reporting/graph_template_list.php @@ -0,0 +1,108 @@ +' + . html_print_image ("images/god6.png", true, array ("title" => __('Graph list'))) + . ''; + +// Header +ui_print_page_header (__('Graph template management'), "", false, "", true, $buttons); + +$delete = get_parameter ('delete_template', 0); +$id_template = get_parameter('id', 0); + +if ($delete) { + $result = db_process_sql_delete ('tgraph_template', + array ('id_graph_template' => $id_template)); + + if ($result !== false) + $result = true; + else + $result = false; + + ui_print_result_message ($result, + __('Successfully deleted'), + __('Not deleted. Error deleting data')); +} + +$own_info = get_user_info ($config['id_user']); +if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) + $return_all_group = true; +else + $return_all_group = false; + +$templates = reporting_template_graphs_get_user ($config['id_user'], false, $return_all_group, "IW"); + +if (! empty ($templates)) { + $table->width = '98%'; + $tale->class = 'databox_frame'; + $table->align = array (); + $table->align[3] = 'center'; + $table->head = array (); + $table->head[0] = __('Template name'); + $table->head[1] = __('Description'); + $table->head[3] = __('Group'); + $table->size[3] = '50px'; + if (check_acl ($config['id_user'], 0, "AW")) { + $table->align[4] = 'center'; + $table->head[4] = __('Delete'); + $table->size[4] = '50px'; + } + $table->data = array (); + + foreach ($templates as $template) { + $data = array (); + + $data[0] = ''.$template['name'].''; + $data[1] = $template["description"]; + + $data[3] = ui_print_group_icon($template['id_group'],true); + + if (check_acl ($config['id_user'], 0, "AW")) { + $data[4] = '' . html_print_image("images/cross.png", true) . ''; + } + + array_push ($table->data, $data); + } + html_print_table ($table); +} +else { + echo "
".__('There are no defined graph templates')."
"; +} + +echo '
'; +echo '
'; +html_print_submit_button (__('Create template'), 'create', false, 'class="sub next"'); +echo "
"; +echo "
"; + +?> diff --git a/pandora_console/godmode/reporting/graphs.php b/pandora_console/godmode/reporting/graphs.php index af195c5acf..902052a0b1 100644 --- a/pandora_console/godmode/reporting/graphs.php +++ b/pandora_console/godmode/reporting/graphs.php @@ -27,12 +27,16 @@ if (! check_acl ($config['id_user'], 0, "IW")) { return; } +$buttons['template'] = '' + . html_print_image ("images/paste_plain.png", true, array ("title" => __('Templates'))) + . ''; + $delete_graph = (bool) get_parameter ('delete_graph'); $view_graph = (bool) get_parameter ('view_graph'); $id = (int) get_parameter ('id'); // Header -ui_print_page_header (__('Graphs management'), "", false, "", true); +ui_print_page_header (__('Graphs management'), "", false, "", true, $buttons); // Delete module SQL code if ($delete_graph) { diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index b13c1564a0..d74c5c0757 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -901,6 +901,7 @@ function get_event_types () { $types['recon_host_detected'] = __('Recon host detected'); $types['system'] = __('System'); $types['error'] = __('Error'); + $types['configuration_change'] = __('configuration change '); if (isset($config['text_char_long'])) { foreach ($types as $key => $type) { diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 8b4942c7cb..2ef8fe6160 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -4640,4 +4640,53 @@ function reporting_get_agentmodule_ttr ($id_agent_module, $period, $date = 0) { return $critical_period; } +/** + * Get all the template graphs a user can see. + * + * @param $id_user User id to check. + * @param $only_names Wheter to return only graphs names in an associative array + * or all the values. + * @param $returnAllGroup Wheter to return graphs of group All or not. + * @param $privileges Privileges to check in user group + * + * @return template graphs of a an user. Empty array if none. + */ +function reporting_template_graphs_get_user ($id_user = 0, $only_names = false, $returnAllGroup = true, $privileges = 'IR') { + global $config; + + if (!$id_user) { + $id_user = $config['id_user']; + } + + $groups = users_get_groups ($id_user, $privileges, $returnAllGroup); + + $all_templates = db_get_all_rows_in_table ('tgraph_template', 'name'); + if ($all_templates === false) + return array (); + + $templates = array (); + foreach ($all_templates as $template) { + if (!in_array($template['id_group'], array_keys($groups))) + continue; + + if ($template["id_user"] != $id_user && $template['private']) + continue; + + if ($template["id_group"] > 0) + if (!isset($groups[$template["id_group"]])){ + continue; + } + + if ($only_names) { + $templates[$template['id_graph_template']] = $template['name']; + } + else { + $templates[$template['id_graph_template']] = $template; + $templatesCount = db_get_value_sql("SELECT COUNT(id_gs) FROM tgraph_source WHERE id_graph = " . $template['id_graph_template']); + $templates[$template['id_graph_template']]['graphs_template_count'] = $templatesCount; + } + } + + return $templates; +} ?> diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index ee48da995c..0b50e8a94b 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -1576,3 +1576,37 @@ CREATE TABLE tevent_filter ( tag VARCHAR2(600) default '' NOT NULL, filter_only_alert NUMBER(10, 0) default -1 NOT NULL ); + +-- ----------------------------------------------------- +-- Table `tgraph_template` +-- ----------------------------------------------------- + +CREATE TABLE tgraph_template ( + id_graph_template NUMBER(10, 0) NOT NULL PRIMARY KEY, + id_user VARCHAR2(255) NOT NULL, + name VARCHAR2(255) NOT NULL, + description CLOB default '', + period NUMBER(11, 0) default 0 NOT NULL, + width SMALLINT default 0 NOT NULL, + height SMALLINT default 0 NOT NULL, + private SMALLINT default 0 NOT NULL, + events SMALLINT default 0 NOT NULL, + stacked SMALLINT default 0 NOT NULL, + id_group NUMBER(8, 0) default 0 +); + +CREATE SEQUENCE tgraph_template_s INCREMENT BY 1 START WITH 1; + +-- ----------------------------------------------------- +-- Table `tgraph_source_template` +-- ----------------------------------------------------- +CREATE tgraph_source_template ( + id_gs_template NUMBER(10, 0) NOT NULL PRIMARY KEY, + id_template NUMBER(10, 0) default 0 NOT NULL, + agent VARCHAR2(255), + module VARCHAR2(255), + weight FLOAT(5) DEFAULT 2 NOT NULL; + exact_match SMALLINT default 0 NOT NULL +); + +CREATE SEQUENCE tgraph_source_template_s INCREMENT BY 1 START WITH 1; diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index 12d7fe7ba1..6f45322fcf 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -1274,3 +1274,36 @@ CREATE TABLE "tevent_filter" ( "tag" varchar(600) NOT NULL default '', "filter_only_alert" INTEGER NOT NULL default -1 ); + +-- ----------------------------------------------------- +-- Table `tgraph_template` +-- ----------------------------------------------------- + +CREATE TABLE IF NOT EXISTS "tgraph_template" ( + "id_graph_template" SERIAL NOT NULL PRIMARY KEY, + "id_user" TEXT NOT NULL default '', + "name" TEXT NOT NULL default '', + "description" TEXT NOT NULL default '', + "period" INTEGER NOT NULL default 0, + "width" SMALLINT NOT NULL default 0, + "height" SMALLINT NOT NULL default 0, + "private" SMALLINT NOT NULL default 0, + "events" SMALLINT NOT NULL default 0, + "stacked" SMALLINT NOT NULL default 0, + "id_group" INTEGER NOT NULL default 0 + ); + + -- ----------------------------------------------------- +-- Table `tgraph_source_template` +-- ----------------------------------------------------- + +CREATE TABLE IF NOT EXISTS "tgraph_source_template" ( + "id_gs_template" SERIAL NOT NULL PRIMARY KEY, + "id_template" INTEGER NOT NULL default 0, + "agent" TEXT NOT NULL default '', + "module" TEXT NOT NULL default '', + "period" INTEGER NOT NULL default 0, + "weight" DOUBLE PRECISION default 2.0, + "exact_match" SMALLINT NOT NULL default 0 + ); + diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index f469e5ab11..541b4925de 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1378,3 +1378,35 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` ( `filter_only_alert` int(10) NOT NULL default -1, PRIMARY KEY (`id_filter`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- ----------------------------------------------------- +-- Table `tgraph_template` +-- ----------------------------------------------------- + +CREATE TABLE IF NOT EXISTS `tgraph_template` ( + `id_graph_template` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `id_user` TEXT NOT NULL, + `name` TEXT NOT NULL, + `description` TEXT NOT NULL, + `period` int(11) NOT NULL default '0', + `width` smallint(5) UNSIGNED NOT NULL DEFAULT 0, + `height` smallint(5) UNSIGNED NOT NULL DEFAULT 0, + `private` tinyint(1) UNSIGNED NOT NULL default 0, + `events` tinyint(1) UNSIGNED NOT NULL default 0, + `stacked` tinyint(1) UNSIGNED NOT NULL default 0, + `id_group` mediumint(8) unsigned NULL default 0, + PRIMARY KEY(`id_graph_template`) +) ENGINE = InnoDB DEFAULT CHARSET=utf8; + +-- ----------------------------------------------------- +-- Table `tgraph_source_template` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tgraph_source_template` ( + `id_gs_template` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `id_template` int(11) NOT NULL default 0, + `agent` TEXT, + `module` TEXT, + `weight` FLOAT(5,3) NOT NULL DEFAULT 2, + `exact_match` tinyint(1) default 0, + PRIMARY KEY(`id_gs_template`) +) ENGINE = InnoDB DEFAULT CHARSET=utf8;