pandorafms/pandora_console/extras/mr/50.sql

75 lines
4.3 KiB
MySQL
Raw Normal View History

2021-09-21 15:59:14 +02:00
START TRANSACTION;
ALTER TABLE `treport_content` ADD COLUMN `ipam_network_filter` int(10) UNSIGNED DEFAULT 0;
ALTER TABLE `treport_content` ADD COLUMN `ipam_alive_ips` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `treport_content` ADD COLUMN `ipam_ip_not_assigned_to_agent` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `treport_content_template` ADD COLUMN `ipam_network_filter` int(10) UNSIGNED DEFAULT 0;
ALTER TABLE `treport_content_template` ADD COLUMN `ipam_alive_ips` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `treport_content_template` ADD COLUMN `ipam_ip_not_assigned_to_agent` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `tevent_alert` ADD COLUMN `id_template_conditions` int(10) unsigned NOT NULL default 0;
ALTER TABLE `tevent_alert` ADD COLUMN `id_template_fields` int(10) unsigned NOT NULL default 0;
2021-07-05 17:43:17 +02:00
ALTER TABLE `tevent_filter` ADD COLUMN `time_from` TIME NULL;
ALTER TABLE `tevent_filter` ADD COLUMN `time_to` TIME NULL;
2021-09-24 11:42:40 +02:00
ALTER TABLE `treport_content_template` ADD COLUMN `time_in_warning_status` TINYINT(1) DEFAULT '0';
ALTER TABLE `treport_content_template` ADD COLUMN `checks_in_warning_status` TINYINT(1) DEFAULT '0';
ALTER TABLE `treport_content` ADD COLUMN `time_in_warning_status` TINYINT(1) DEFAULT '0';
ALTER TABLE `treport_content` ADD COLUMN `checks_in_warning_status` TINYINT(1) DEFAULT '0';
2021-09-30 16:02:14 +02:00
INSERT INTO `treport_content` (id_report, id_gs, id_agent_module, type, period, `order`, name, description, id_agent, `text`, external_source, treport_custom_sql_id, header_definition, column_separator, line_separator, time_from, time_to, style, server_name, time_in_warning_status, checks_in_warning_status, failover_mode) SELECT id_report, 0, id_agent_module, 'availability', period, `order`, name, description, id_agent, NULL, NULL, treport_custom_sql_id, header_definition, column_separator, line_separator, time_from, time_to, '{"show_in_same_row":0,"hide_notinit_agents":0,"priority_mode":1,"dyn_height":"230"}', server_name, 1, 1, 0 FROM treport_content WHERE type = 'histogram_data';
2021-09-24 11:42:40 +02:00
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';
2021-09-21 15:59:14 +02:00
2021-09-28 18:53:22 +02:00
CREATE TABLE IF NOT EXISTS `tncm_template` (
`id` serial,
2021-10-08 15:12:23 +02:00
`name` text,
`vendor` varchar(500),
`model` varchar(500),
2021-10-08 16:02:06 +02:00
PRIMARY KEY (`id`)
2021-09-28 18:53:22 +02:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tncm_script` (
`id` serial,
`type` int unsigned not null default 0,
`content` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tncm_template_scripts` (
`id` serial,
`id_template` bigint(20) unsigned NOT NULL,
`id_script` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_template`) REFERENCES `tncm_template`(`id`) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (`id_script`) REFERENCES `tncm_script`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tncm_agent` (
2021-09-28 18:53:22 +02:00
`id_agent` int(10) unsigned NOT NULL,
2021-10-05 16:42:24 +02:00
`vendor` text,
`model` text,
2021-09-28 18:53:22 +02:00
`protocol` int unsigned not null default 0,
`cred_key` varchar(100),
2021-10-04 19:43:57 +02:00
`status` int(4) NOT NULL default 5,
2021-10-05 16:42:24 +02:00
`updated_at` bigint(20) NOT NULL default 0,
`config_backup_id` bigint(20) UNSIGNED DEFAULT NULL,
2021-10-08 15:30:17 +02:00
`id_template` bigint(20) unsigned,
`execute` int(2) UNSIGNED NOT NULL default 0,
PRIMARY KEY (`id_agent`),
2021-09-28 18:53:22 +02:00
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
2021-10-08 15:12:23 +02:00
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
2021-10-05 16:42:24 +02:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tncm_agent_data` (
2021-10-08 15:30:17 +02:00
`id` serial,
2021-10-05 16:42:24 +02:00
`id_agent` int(10) unsigned NOT NULL,
2021-10-08 15:12:23 +02:00
`script_type` int unsigned not null,
2021-10-05 16:42:24 +02:00
`data` LONGBLOB,
`status` int(4) NOT NULL default 5,
`updated_at` bigint(20) NOT NULL default 0,
2021-10-08 15:12:23 +02:00
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2021-10-08 15:30:17 +02:00
2021-09-21 15:59:14 +02:00
COMMIT;