Added tncm_vendor and model to manage targetrs

This commit is contained in:
fbsanchez 2021-10-14 20:44:05 +02:00
parent 96250dcfa0
commit 79174d512d
3 changed files with 75 additions and 23 deletions

View File

@ -19,11 +19,25 @@ INSERT INTO `treport_content` (id_report, id_gs, id_agent_module, type, period,
INSERT INTO `treport_content_item` (id_report_content, id_agent_module, id_agent_module_failover, operation, server_name) SELECT id_rc, id_agent_module, 0, '', server_name FROM treport_content WHERE type = 'availability' AND id_agent <> 0 AND id_agent_module <> 0;
DELETE FROM `treport_content` WHERE type = 'histogram_data';
CREATE TABLE IF NOT EXISTS `tncm_vendor` (
`id` serial,
`name` TEXT UNIQUE,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tncm_model` (
`id` serial,
`id_vendor` bigint(20) unsigned NOT NULL,
`name` TEXT UNIQUE,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_vendor`) REFERENCES `tncm_vendor`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tncm_template` (
`id` serial,
`name` text,
`vendor` varchar(500),
`model` varchar(500),
`vendors` text,
`models` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -45,8 +59,8 @@ CREATE TABLE IF NOT EXISTS `tncm_template_scripts` (
CREATE TABLE IF NOT EXISTS `tncm_agent` (
`id_agent` int(10) unsigned NOT NULL,
`vendor` text,
`model` text,
`id_vendor` bigint(20) unsigned NOT NULL,
`id_model` bigint(20) unsigned NOT NULL,
`protocol` int unsigned not null default 0,
`cred_key` varchar(100),
`port` int(4) unsigned default 22,
@ -60,7 +74,7 @@ CREATE TABLE IF NOT EXISTS `tncm_agent` (
PRIMARY KEY (`id_agent`),
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (`cred_key`) REFERENCES `tcredential_store`(`identifier`) ON UPDATE CASCADE ON DELETE SET NULL,
FOREIGN KEY (`id_template`) REFERENCES `tncm_template`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
FOREIGN KEY (`id_template`) REFERENCES `tncm_template`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tncm_agent_data` (
@ -73,5 +87,4 @@ CREATE TABLE IF NOT EXISTS `tncm_agent_data` (
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
COMMIT;

View File

@ -4093,14 +4093,34 @@ CREATE TABLE IF NOT EXISTS `talert_execution_queue` (
UPDATE `tlanguage` SET `name` = 'Deutsch' WHERE `id_language` = 'de';
-- ----------------------------------------------------------------------
-- Table `tncm_vendor`
-- ----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tncm_vendor` (
`id` serial,
`name` TEXT UNIQUE,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- Table `tncm_model`
-- ----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tncm_model` (
`id` serial,
`id_vendor` bigint(20) unsigned NOT NULL,
`name` TEXT UNIQUE,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_vendor`) REFERENCES `tncm_vendor`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- Table `tncm_template`
-- ----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tncm_template` (
`id` serial,
`name` text,
`vendor` varchar(500),
`model` varchar(500),
`vendors` text,
`models` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -4131,22 +4151,22 @@ CREATE TABLE IF NOT EXISTS `tncm_template_scripts` (
-- ----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tncm_agent` (
`id_agent` int(10) unsigned NOT NULL,
`vendor` text,
`model` text,
`id_vendor` bigint(20) unsigned NOT NULL,
`id_model` bigint(20) unsigned NOT NULL,
`protocol` int unsigned not null default 0,
`cred_key` varchar(100),
`port` int(4) unsigned default 22,
`port` int(4) unsigned default 22,
`status` int(4) NOT NULL default 5,
`updated_at` bigint(20) NOT NULL default 0,
`config_backup_id` bigint(20) UNSIGNED DEFAULT NULL,
`id_template` bigint(20) unsigned,
`execute_type` int(2) UNSIGNED NOT NULL default 0,
`execute_type` int(2) UNSIGNED NOT NULL default 0,
`execute` int(2) UNSIGNED NOT NULL default 0,
`last_error` text,
`last_error` text,
PRIMARY KEY (`id_agent`),
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (`cred_key`) REFERENCES `tcredential_store`(`identifier`) ON UPDATE CASCADE ON DELETE SET NULL,
FOREIGN KEY (`id_template`) REFERENCES `tncm_template`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
FOREIGN KEY (`id_template`) REFERENCES `tncm_template`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
@ -4161,4 +4181,3 @@ CREATE TABLE IF NOT EXISTS `tncm_agent_data` (
`updated_at` bigint(20) NOT NULL default 0,
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -4029,14 +4029,34 @@ CREATE TABLE IF NOT EXISTS `tsync_queue` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- Table `tncm_vendor`
-- ----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tncm_vendor` (
`id` serial,
`name` TEXT UNIQUE,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- Table `tncm_model`
-- ----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tncm_model` (
`id` serial,
`id_vendor` bigint(20) unsigned NOT NULL,
`name` TEXT UNIQUE,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_vendor`) REFERENCES `tncm_vendor`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- Table `tncm_template`
-- ----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tncm_template` (
`id` serial,
`name` text,
`vendor` varchar(500),
`model` varchar(500),
`vendors` text,
`models` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -4067,22 +4087,22 @@ CREATE TABLE IF NOT EXISTS `tncm_template_scripts` (
-- ----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tncm_agent` (
`id_agent` int(10) unsigned NOT NULL,
`vendor` text,
`model` text,
`id_vendor` bigint(20) unsigned NOT NULL,
`id_model` bigint(20) unsigned NOT NULL,
`protocol` int unsigned not null default 0,
`cred_key` varchar(100),
`port` int(4) unsigned default 22,
`port` int(4) unsigned default 22,
`status` int(4) NOT NULL default 5,
`updated_at` bigint(20) NOT NULL default 0,
`config_backup_id` bigint(20) UNSIGNED DEFAULT NULL,
`id_template` bigint(20) unsigned,
`execute_type` int(2) UNSIGNED NOT NULL default 0,
`execute_type` int(2) UNSIGNED NOT NULL default 0,
`execute` int(2) UNSIGNED NOT NULL default 0,
`last_error` text,
`last_error` text,
PRIMARY KEY (`id_agent`),
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (`cred_key`) REFERENCES `tcredential_store`(`identifier`) ON UPDATE CASCADE ON DELETE SET NULL,
FOREIGN KEY (`id_template`) REFERENCES `tncm_template`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
FOREIGN KEY (`id_template`) REFERENCES `tncm_template`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------