2011-05-26 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* include/styles/menu.css: Added new background image on css 
	tag entry.
	* include/functions_tags.php: Added new function code for tag 
	functionality.
	* pandoradb.sql
	pandoradb.postgreSQL.sql
	pandoradb.oracle.sql
	extras/pandoradb_migrate_v3.2_to_v4.0.sql: Added new tables "ttag",
	"ttag_module", "ttag_policy_module" and "ttag_event".
	* godmode/tag: Added new path.
	* godmode/menu.php
	godmode/tag/tag.php
	godmode/tag/edit_tag.php: Tag editor for events correlation engine.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4383 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2011-05-26 10:51:17 +00:00
parent ff3ef7adf9
commit c87a3dd689
10 changed files with 744 additions and 0 deletions

View File

@ -1,3 +1,19 @@
2011-05-26 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/styles/menu.css: Added new background image on css
tag entry.
* include/functions_tags.php: Added new function code for tag
functionality.
* pandoradb.sql
pandoradb.postgreSQL.sql
pandoradb.oracle.sql
extras/pandoradb_migrate_v3.2_to_v4.0.sql: Added new tables "ttag",
"ttag_module", "ttag_policy_module" and "ttag_event".
* godmode/tag: Added new path.
* godmode/menu.php
godmode/tag/tag.php
godmode/tag/edit_tag.php: Tag editor for events correlation engine.
2011-05-25 Sergio Martin <sergio.martin@artica.es>
* images/policies_error_db.png: Added new image to policies

View File

@ -124,3 +124,48 @@ UPDATE `tserver` SET `keepalive` = "01-01-1970 00:00:00" WHERE `keepalive` = "00
UPDATE `ttrap` SET `timestamp` = "01-01-1970 00:00:00" WHERE `timestamp` = "0000-00-00 00:00:00";
UPDATE `tnews` SET `timestamp` = "01-01-1970 00:00:00" WHERE `timestamp` = "0000-00-00 00:00:00";
UPDATE `tserver_export` SET `timestamp` = "01-01-1970 00:00:00" WHERE `timestamp` = "0000-00-00 00:00:00";
-- -----------------------------------------------------
-- Table `ttag`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `ttag` (
`id_tag` integer(10) unsigned NOT NULL auto_increment,
`name` varchar(100) NOT NULL default '',
`description` text NOT NULL default '',
`url` mediumtext NOT NULL default '',
PRIMARY KEY (`id_tag`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `ttag_module`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `ttag_module` (
`id_tag` int(10) NOT NULL,
`id_agente_modulo` int(10) NOT NULL DEFAULT 0,
PRIMARY KEY (id_tag, id_agente_modulo),
KEY `idx_id_agente_modulo` (`id_agente_modulo`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `ttag_policy_module`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `ttag_policy_module` (
`id_tag` int(10) NOT NULL,
`id_policy_module` int(10) NOT NULL DEFAULT 0,
PRIMARY KEY (id_tag, id_policy_module),
KEY `idx_id_policy_module` (`id_policy_module`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `ttag_event`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `ttag_event` (
`id_tag` int(10) NOT NULL,
`id_evento` bigint(20) NOT NULL DEFAULT 0,
PRIMARY KEY (id_tag, id_evento),
KEY `idx_id_evento` (`id_evento`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -173,6 +173,11 @@ if (check_acl ($config['id_user'], 0, "PM")) {
$menu["glog"]["text"] = __('System audit log');
$menu["glog"]["sec2"] = "godmode/admin_access_logs";
$menu["glog"]["id"] = "god-audit";
// Tag
$menu["gtag"]["text"] = __('Manage tags');
$menu["gtag"]["sec2"] = "godmode/tag/tag";
$menu["gtag"]["id"] = "god-tag";
// Setup
$menu["gsetup"]["text"] = __('Setup');

View File

@ -0,0 +1,158 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
check_login ();
//Include functions code
require_once ($config['homedir'].'/include/functions_tags.php');
if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) {
db_pandora_audit("ACL Violation", "Trying to access Edit Skin");
require ("general/noaccess.php");
return;
}
// Get parameters
$action = (string) get_parameter ("action", "");
$id_tag = (int) get_parameter ("id_tag", 0);
$update_tag = (int) get_parameter ("update_tag", 0);
$create_tag = (int) get_parameter ("create_tag", 0);
$name_tag = (string) get_parameter ("name_tag", "");
$description_tag = (string) get_parameter ("description_tag", "");
$url_tag = (string) get_parameter ("url_tag", "");
// Header
ui_print_page_header (__('Tags configuration'), "images/comments.png", false, "", true);
// Two actions can performed in this page: update and create tags
// Update tag: update an existing tag
if ($update_tag && $id_tag != 0) {
$values = array();
$values['name'] = $name_tag;
$values['description'] = $description_tag;
$values['url'] = $url_tag;
$result = tags_update_tag($values);
if ($result === false) {
echo '<h3 class="error">'.__('Error updating tag').'</h3>';
} else {
echo '<h3 class="suc">'.__('Successfully updated skin').'</h3>';
}
}
// Create tag: creates a new tag
if ($create_tag) {
$return_create = true;
$data = array();
$data['name'] = $name_tag;
$data['description'] = $description_tag;
$data['url'] = $url_tag;
// DB insert
$return_create = tags_create_tag ($data);
if ($return_create === false) {
echo '<h3 class="error">'.__('Error creating tag').'</h3>';
$action = "new";
// If create action ends successfully then current action is update
} else {
echo '<h3 class="suc">'.__('Successfully created tag').'</h3>';
$id_tag = $return_create;
$action = "update";
}
}
// Form fields are filled here
// Get results when update action is performed
if ($action == "update" && $id_tag != 0){
$result_tag = tags_search_tag_id($id_tag);
$name_tag = $result_tag["name"];
$description_tag = $result_tag["description"];
$url_tag = $result_tag["url"];
// If current action is create (new) or somethig goes wrong fields are filled with void value
}else{
$name_tag = "";
$description_tag = "";
$url_tag = "";
}
// Create/Update tag form
echo '<form method="post" action="index.php?sec=gtag&sec2=godmode/tag/edit_tag&action=' . $action . '&id_tag=' . $id_tag . '" enctype="multipart/form-data">';
echo '<div align=left style="width: 98%" class="pandora_form">';
echo "<table border=0 cellpadding=4 cellspacing=4 class=databox width=85%>";
echo "<tr>";
echo "<td>";
if ($action == "update"){
echo '<h3>'.__("Edit tag").'</h3>';
}
if ($action == "new"){
echo '<h3>'.__("New tag").'</h3>';
}
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td align=center>";
html_print_label (__("Name"),'name');
echo "</td>";
echo "<td align=center>";
html_print_input_text ('name_tag', $name_tag);
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td align=left>";
html_print_label (__("Description"),'name');
echo "</td>";
echo "<td align=center>";
html_print_input_text ('description_tag', $description_tag);
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td align=left>";
echo '<b>' . __("Url") . '</b>';
echo ui_print_help_tip (__("Hyperlink to help information that has to exist previously."), true);
echo "</td>";
echo "<td align=center>";
html_print_input_text ('url_tag', $url_tag);
echo "</td>";
echo "</tr>";
echo "<tr>";
if ($action == "update"){
echo "<td align=center>";
html_print_input_hidden ('update_tag', 1);
echo "</td>";
echo "<td align=right>";
html_print_submit_button (__('Update'), 'update_button', false, 'class="sub next"');
echo "</td>";
}
if ($action == "new"){
echo "<td align=center>";
html_print_input_hidden ('create_tag', 1);
echo "</td>";
echo "<td align=right>";
html_print_submit_button (__('Create'), 'create_button', false, 'class="sub next"');
echo "</td>";
}
echo "</tr>";
echo "</table>";
echo '</div>';
echo '</form>';
?>

View File

@ -0,0 +1,172 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
// Check login and ACLs
check_login ();
if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) {
db_pandora_audit("ACL Violation", "Trying to access Tag Management");
require ("general/noaccess.php");
return;
}
//Include functions code
require_once ($config['homedir'].'/include/functions_tags.php');
// Get parameters
$delete = (int) get_parameter ("delete_tag", 0);
$search = (int) get_parameter ("search_tag", 0);
$tag_name = (string) get_parameter ("tag_name","");
//Ajax tooltip to deploy module's count info of a tag.
if (is_ajax ()) {
$get_tag_tooltip = (bool) get_parameter ('get_tag_tooltip', 0);
if ($get_tag_tooltip) {
$id_tag = (int) get_parameter ('id_tag');
$tag = tags_search_tag_id ($id_tag);
if ($tag === false)
return;
echo '<h3>'.$tag['name'].'</h3>';
echo '<strong>'.__('Number of modules').': </strong> ' .
tags_get_local_modules_count($id);
echo '<br>';
echo '<strong>'.__('Number of policy modules').': </strong>' .
tags_get_policy_modules_count($id);
return;
}
return;
}
// Header
ui_print_page_header (__('Tags configuration'), "images/comments.png", false, "", true);
// Two actions can performed in this page: search and delete tags
// Delete action: This will delete a tag
if ($delete != 0) {
$return_delete = tags_delete_tag ($delete);
if ($return_delete === false) {
echo '<h3 class="error">'.__('Error deleting tag').'</h3>';
} else {
echo '<h3 class="suc">'.__('Successfully deleted tag').'</h3>';
}
}
// Search action: This will filter the display tag view
$result = false;
// Filtered view?
if ($search != 0) {
$result = tags_search_tag($tag_name);
}
else{
$result = tags_search_tag();
}
// Form to add new tags or search tags
echo "<table border=0 cellpadding=4 cellspacing=4 class=databox width=95%>";
echo "<tr>";
echo "<td>";
echo '<b>' . __("Name") . "/" . __("Description") . '</b>';
echo "<td align=center>";
echo '<form method=post action="index.php?sec=gtag&sec2=godmode/tag/tag&delete_tag=0">';
html_print_input_hidden ("search_tag", "1");
html_print_input_text ('tag_name', $tag_name, '', 30, 255, false);
echo "&nbsp;&nbsp;&nbsp;";
html_print_submit_button (__('Filter'), 'filter_button', false, 'class="sub search"');
echo "</form>";
echo "<td align=right>";
echo '<form method="post" action="index.php?sec=gtag&sec2=godmode/tag/edit_tag&action=new">';
html_print_input_hidden ("create_tag", "1", true);
html_print_submit_button (__('Create tag'), 'create_button', false, 'class="sub next"');
echo "</form>";
echo "</table>";
// Display tags previously filtered or not
$rowPair = true;
$iterator = 0;
if (!empty($result)){
$table->width = '95%';
$table->data = array ();
$table->head = array ();
$table->align = array ();
$table->style = array ();
$table->style[0] = 'font-weight: bold; text-align:center';
$table->style[1] = 'text-align:center';
$table->style[2] = 'text-align:center';
$table->style[3] = 'text-align:center';
$table->style[4] = 'text-align:center';
$table->head[0] = __('Tag name');
$table->head[1] = __('Description');
$table->head[2] = __('Detail information');
$table->head[3] = __('Number of modules affected');
$table->head[4] = __('Actions');
foreach ($result as $tag) {
if ($rowPair)
$table->rowclass[$iterator] = 'rowPair';
else
$table->rowclass[$iterator] = 'rowOdd';
$rowPair = !$rowPair;
$iterator++;
$data = array ();
$data[0] = $tag["name"];
$data[1] = $tag["description"];
$data[2] = '<a href="' . $tag["url"] . '">' . $tag["url"] . '</a>';
$data[3] = ' <a class="tag_details"
href="ajax.php?page=godmode/tag/tag&get_tag_tooltip=1&id_tag='.$tag['id_tag'].'">' .
html_print_image("images/zoom.png", true, array("id" => 'tag-details-'.$tag['id_tag'], "class" => "img_help")) . '</a> ';
$data[3] .= tags_get_modules_count($tag["id_tag"]);
$data[4] = "<a href='index.php?sec=gtag&sec2=godmode/tag/edit_tag&action=update&id_tag=".$tag["id_tag"] . "'>" . html_print_image("images/config.png", true, array("title" => "Edit")) . "</a>";
$data[4] .= '<a href="index.php?sec=gtag&sec2=godmode/tag/tag&delete_tag='.$tag["id_tag"] . '"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">' . html_print_image("images/cross.png", true, array("title" => "Delete")) . '</a>';
array_push ($table->data, $data);
}
html_print_table ($table);
// No tags available or selected
}else
echo "<div class='nf'>".__('No tags selected')."</div>";
ui_require_css_file ('cluetip');
ui_require_jquery_file ('cluetip');
?>
<script type="text/javascript">
/* <![CDATA[ */
$("a.tag_details").cluetip ({
arrows: true,
attribute: 'href',
cluetipClass: 'default'
}).click (function () {
return false;
});
/* ]]> */
</script>

View File

@ -0,0 +1,202 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/**
* @package Include
* @subpackage TAGS
*/
/**
* Find a tag searching by tag's or description name.
*
* @param string $tag_name_description Name or description of the tag that it's currently searched.
*
* @return mixed Returns an array with the tag selected by name or false.
*/
function tags_search_tag ($tag_name_description = false) {
global $config;
if ($tag_name_description){
switch ($config["dbtype"]) {
case "mysql":
$sql = 'SELECT * FROM ttag WHERE ((name COLLATE utf8_general_ci LIKE "%'. $tag_name_description .'%") OR
(description COLLATE utf8_general_ci LIKE "%'. $tag_name_description .'%"))';
break;
case "postgresql":
$sql = 'SELECT * FROM ttag WHERE ((name COLLATE utf8_general_ci LIKE \'%'. $tag_name_description .'%\') OR
(description COLLATE utf8_general_ci LIKE \'%'. $tag_name_description .'%\'))';
break;
case "oracle":
$sql = 'SELECT * FROM ttag WHERE (UPPER(name) LIKE UPPER (\'%'. $tag_name_description .'%\') OR
UPPER(description) LIKE UPPER (\'%'. $tag_name_description .'%\'))';
break;
}
}
else{
$sql = 'SELECT * FROM ttag';
}
$result = db_get_all_rows_sql ($sql);
if ($result === false)
return array (); //Return an empty array
else
return $result;
}
/**
* Create a new tag.
*
* @param array $values Array with all values to insert.
*
* @return mixed Tag id or false.
*/
function tags_create_tag($values){
if (empty($values)){
return false;
}
return db_process_sql_insert('ttag',$values);
}
/**
* Search tag by id.
*
* @param array $id Int with tag id info.
*
* @return mixed Array with the seleted tag or false.
*/
function tags_search_tag_id($id){
return db_get_row ('ttag', 'id_tag', $id);
}
/**
* Get tag name.
*
* @param array $id Int with tag id info.
*
* @return mixed String with tag name or false.
*/
function tags_get_name($id){
return db_get_value_filter ('name', 'ttag', 'id_tag', $id);
}
/**
* Get tag description.
*
* @param array $id Int with tag id info.
*
* @return mixed String with tag description or false.
*/
function tags_get_description($id){
return db_get_value_filter('description', 'ttag', 'id_tag', $id);
}
/**
* Get tag url.
*
* @param array $id Int with tag id info.
*
* @return mixed String with tag url or false.
*/
function tags_get_url($id){
return db_get_value_filter('description', 'ttag', 'id_tag', $id);
}
/**
* Get tag's module count.
*
* @param array $id Int with tag id info.
*
* @return mixed Int with the tag's count or false.
*/
function tags_get_modules_count($id){
$num_modules = (int)db_get_value_filter('count(*)', 'ttag_module', 'id_tag', $id);
$num_policy_modules = (int)db_get_value_filter('count(*)', 'ttag_policy_module', 'id_tag', $id);
return $num_modules + $num_policy_modules;
}
/**
* Get tag's local module count.
*
* @param array $id Int with tag id info.
*
* @return mixed Int with the tag's count or false.
*/
function tags_get_local_modules_count($id){
$num_modules = (int)db_get_value_filter('count(*)', 'ttag_module', 'id_tag', $id);
return $num_modules;
}
/**
* Get tag's policy module count.
*
* @param array $id Int with tag id info.
*
* @return mixed Int with the tag's count or false.
*/
function tags_get_policy_modules_count($id){
$num_policy_modules = (int)db_get_value_filter('count(*)', 'ttag_policy_module', 'id_tag', $id);
return $num_policy_modules;
}
/**
* Updates a tag by id.
*
* @param array $id Int with tag id info.
*
* @return bool True or false if something goes wrong.
*/
function tags_update_tag($values){
return db_process_sql_update ('ttag', $values);
}
/**
* Delete a tag by id.
*
* @param array $id Int with tag id info.
*
* @return bool True or false if something goes wrong.
*/
function tags_delete_tag ($id_tag){
$errn = 0;
$result_tag = db_process_delete_temp ('ttag', 'id_tag', $id_tag);
if ($result_tag === false)
$errn++;
$result_module = db_process_delete_temp ('ttag_module', 'id_tag', $id_tag);
if ($result_module === false)
$errn++;
$result_policy = db_process_delete_temp ('ttag_policy_module', 'id_tag', $id_tag);
if ($result_policy === false)
$errn++;
if ($errn == 0){
db_process_sql_commit();
return true;
}
else{
db_process_sql_rollback();
return false;
}
}

View File

@ -182,4 +182,7 @@
#icon_oper-inventory {
background-image: url(../../images/page_white_text.png);
}
#icon_god-tag {
background-image: url(../../images/comments.png);
}

View File

@ -1408,3 +1408,54 @@ CREATE OR REPLACE TRIGGER tagent_custom_data_update1 AFTER UPDATE OF ID_AGENTE O
-- Procedure for retrieve PK information after an insert statement
CREATE OR REPLACE PROCEDURE insert_id (table_name IN VARCHAR2, sql_insert IN VARCHAR2, id OUT NUMBER) IS BEGIN EXECUTE IMMEDIATE sql_insert; EXECUTE IMMEDIATE 'SELECT ' ||table_name||'_s.currval FROM DUAL' INTO id; EXCEPTION WHEN others THEN RAISE_APPLICATION_ERROR(-20001, 'ERROR on insert_id procedure, please check input parameters or procedure logic.'); END insert_id;;
-- -----------------------------------------------------
-- Table "ttag"
-- -----------------------------------------------------
CREATE TABLE ttag (
id_tag NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(100) default '' NOT NULL,
description CLOB default '' NOT NULL,
url CLOB default '' NOT NULL
);
CREATE SEQUENCE ttag_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER ttag_inc BEFORE INSERT ON ttag REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT ttag_s.nextval INTO :NEW.ID_TAG FROM dual; END ttag_inc;;
-- -----------------------------------------------------
-- Table "ttag_module"
-- -----------------------------------------------------
CREATE TABLE ttag_module (
id_tag NUMBER(10, 0) NOT NULL,
id_agente_modulo NUMBER(10, 0) DEFAULT 0 NOT NULL,
PRIMARY KEY (id_tag, id_agente_modulo)
);
CREATE INDEX ttag_module_id_ag_modulo_idx ON ttag_module(id_agente_modulo);
-- -----------------------------------------------------
-- Table "ttag_policy_module"
-- -----------------------------------------------------
CREATE TABLE ttag_policy_module (
id_tag NUMBER(10, 0) NOT NULL,
id_policy_module NUMBER(10, 0) DEFAULT 0 NOT NULL,
PRIMARY KEY (id_tag, id_policy_module)
);
CREATE INDEX ttag_poli_mod_id_pol_mo_idx ON ttag_policy_module(id_policy_module);
-- -----------------------------------------------------
-- Table "ttag_event"
-- -----------------------------------------------------
CREATE TABLE ttag_event (
id_tag NUMBER(10, 0) NOT NULL,
id_evento NUMBER(19, 0) DEFAULT 0 NOT NULL,
PRIMARY KEY (id_tag, id_evento)
);
CREATE INDEX ttag_event_id_evento_idx ON ttag_event(id_evento);

View File

@ -1136,3 +1136,50 @@ CREATE TABLE "tagent_custom_data" (
"description" text default '',
PRIMARY KEY ("id_field", "id_agent")
);
-- -----------------------------------------------------
-- Table "ttag"
-- -----------------------------------------------------
CREATE TABLE "ttag" (
"id_tag" SERIAL NOT NULL PRIMARY KEY,
"name" VARCHAR2(100) NOT NULL default '',
"description" text NOT NULL default '',
"url" text NOT NULL default ''
);
-- -----------------------------------------------------
-- Table "ttag_module"
-- -----------------------------------------------------
CREATE TABLE "ttag_module" (
"id_tag" INTEGER NOT NULL,
"id_agente_modulo" INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY (id_tag, id_agente_modulo)
);
CREATE INDEX "ttag_module_id_ag_modulo_idx" ON "ttag_module"("id_agente_modulo");
-- -----------------------------------------------------
-- Table "ttag_policy_module"
-- -----------------------------------------------------
CREATE TABLE "ttag_policy_module" (
"id_tag" INTEGER NOT NULL,
"id_policy_module" INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY (id_tag, id_policy_module)
);
CREATE INDEX "ttag_poli_mod_id_pol_mo_idx" ON "ttag_policy_module"("id_policy_module");
-- -----------------------------------------------------
-- Table "ttag_event"
-- -----------------------------------------------------
CREATE TABLE "ttag_event" (
id_tag INTEGER NOT NULL,
id_evento BIGINT(20) NOT NULL DEFAULT 0,
PRIMARY KEY (id_tag, id_evento)
);
CREATE INDEX "ttag_event_id_evento_idx" ON "ttag_event"("id_evento");

View File

@ -1212,3 +1212,48 @@ CREATE TABLE IF NOT EXISTS `tagent_custom_data` (
ON UPDATE CASCADE ON DELETE CASCADE,
PRIMARY KEY (`id_field`, `id_agent`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `ttag`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `ttag` (
`id_tag` integer(10) unsigned NOT NULL auto_increment,
`name` varchar(100) NOT NULL default '',
`description` text NOT NULL default '',
`url` mediumtext NOT NULL default '',
PRIMARY KEY (`id_tag`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `ttag_module`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `ttag_module` (
`id_tag` int(10) NOT NULL,
`id_agente_modulo` int(10) NOT NULL DEFAULT 0,
PRIMARY KEY (id_tag, id_agente_modulo),
KEY `idx_id_agente_modulo` (`id_agente_modulo`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `ttag_policy_module`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `ttag_policy_module` (
`id_tag` int(10) NOT NULL,
`id_policy_module` int(10) NOT NULL DEFAULT 0,
PRIMARY KEY (id_tag, id_policy_module),
KEY `idx_id_policy_module` (`id_policy_module`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `ttag_event`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `ttag_event` (
`id_tag` int(10) NOT NULL,
`id_evento` bigint(20) NOT NULL DEFAULT 0,
PRIMARY KEY (id_tag, id_evento),
KEY `idx_id_evento` (`id_evento`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;