|
|
@@ -1,19 +1,19 @@
|
|
|
drop table if exists it_user;
|
|
|
CREATE TABLE `it_user`
|
|
|
(
|
|
|
- `user_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
|
|
|
+ `user_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
|
|
|
`user` VARCHAR(255) NOT NULL COMMENT '用户名',
|
|
|
`display_name` VARCHAR(255) NOT NULL COMMENT '显示名称',
|
|
|
`password` VARCHAR(255) NOT NULL COMMENT '密码',
|
|
|
`phone_number` VARCHAR(255) NOT NULL COMMENT '手机号码',
|
|
|
- `role_id` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '角色ID',
|
|
|
+ `role_id` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '角色ID',
|
|
|
PRIMARY KEY (`user_id`)
|
|
|
) COMMENT ='用户表';
|
|
|
|
|
|
drop table if exists it_role;
|
|
|
CREATE TABLE `it_role`
|
|
|
(
|
|
|
- `role_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '角色ID',
|
|
|
+ `role_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '角色ID',
|
|
|
`name` VARCHAR(255) NOT NULL COMMENT '角色名称',
|
|
|
PRIMARY KEY (`role_id`)
|
|
|
) COMMENT ='角色表';
|
|
|
@@ -21,7 +21,7 @@ CREATE TABLE `it_role`
|
|
|
drop table if exists it_sys;
|
|
|
CREATE TABLE `it_sys`
|
|
|
(
|
|
|
- `sys_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '系统ID',
|
|
|
+ `sys_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '系统ID',
|
|
|
`name` VARCHAR(255) NOT NULL COMMENT '系统名称',
|
|
|
PRIMARY KEY (`sys_id`)
|
|
|
) COMMENT ='系统表';
|
|
|
@@ -37,7 +37,7 @@ CREATE TABLE `it_role_permission`
|
|
|
drop table if exists it_resource_group;
|
|
|
create table `it_resource_group`
|
|
|
(
|
|
|
- `group_id` bigint(20) not null AUTO_INCREMENT comment '资源组ID',
|
|
|
+ `group_id` bigint(20) not null AUTO_INCREMENT comment '资源组ID',
|
|
|
`group_name` varchar(255) not null comment '资源组名称',
|
|
|
primary key (`group_id`)
|
|
|
) comment ='资源组';
|
|
|
@@ -46,8 +46,8 @@ create table `it_resource_group`
|
|
|
drop table if exists it_resource_attribute;
|
|
|
create table `it_resource_attribute`
|
|
|
(
|
|
|
- `attribute_id` bigint(20) not null AUTO_INCREMENT comment '属性ID',
|
|
|
- `group_id` bigint(20) not null comment '资源组ID',
|
|
|
+ `attribute_id` bigint(20) not null AUTO_INCREMENT comment '属性ID',
|
|
|
+ `group_id` bigint(20) not null comment '资源组ID',
|
|
|
`attribute_name` varchar(255) not null comment '属性名称',
|
|
|
`display_name` varchar(255) not null comment '显示名称',
|
|
|
`attribute_type` tinyint not null comment '资源属性类型:0普通(文本、数字等),1表格,2下拉选项',
|
|
|
@@ -60,9 +60,9 @@ create table `it_resource_attribute`
|
|
|
drop table if exists it_resource_type;
|
|
|
create table `it_resource_type`
|
|
|
(
|
|
|
- `type_id` bigint(20) not null auto_increment comment '资源类型ID',
|
|
|
+ `type_id` bigint(20) not null auto_increment comment '资源类型ID',
|
|
|
`type_name` varchar(255) not null comment '资源名称',
|
|
|
- `parent_type_id` bigint(20) not null default -1 comment '父类型ID',
|
|
|
+ `parent_type_id` bigint(20) not null default -1 comment '父类型ID',
|
|
|
primary key (`type_id`)
|
|
|
) comment ='资源类型';
|
|
|
|
|
|
@@ -70,10 +70,10 @@ create table `it_resource_type`
|
|
|
drop table if exists it_resource;
|
|
|
create table `it_resource`
|
|
|
(
|
|
|
- `resource_id` bigint(20) not null auto_increment comment '资源ID',
|
|
|
+ `resource_id` bigint(20) not null auto_increment comment '资源ID',
|
|
|
`resource_name` varchar(255) not null comment '资源名称',
|
|
|
- `type_id` bigint(20) not null comment '资源类型ID',
|
|
|
- `group_id` bigint(20) not null comment '资源组ID',
|
|
|
+ `type_id` bigint(20) not null comment '资源类型ID',
|
|
|
+ `group_id` bigint(20) not null comment '资源组ID',
|
|
|
`remark` varchar(255) not null default '' comment '资源备注',
|
|
|
primary key (`resource_id`)
|
|
|
) comment ='资源';
|
|
|
@@ -83,17 +83,17 @@ create table `it_resource_value`
|
|
|
(
|
|
|
`resource_id` bigint(20) not null comment '资源ID',
|
|
|
`attribute_id` bigint(20) not null comment '属性ID',
|
|
|
- `attribute_value` text not null comment '资源属性的值',
|
|
|
+ `attribute_value` text not null comment '资源属性的值',
|
|
|
primary key (`resource_id`, `attribute_id`)
|
|
|
) comment ='资源属性的值';
|
|
|
|
|
|
drop TABLE if exists it_monitor_agent;
|
|
|
CREATE TABLE `it_monitor_agent`
|
|
|
(
|
|
|
- `agent_id` BIGINT(20) NOT NULL AUTO_INCREMENT,
|
|
|
+ `agent_id` BIGINT(20) NOT NULL AUTO_INCREMENT,
|
|
|
`agent_name` VARCHAR(255) NOT NULL DEFAULT '',
|
|
|
`agent_ip` VARCHAR(255) NOT NULL DEFAULT '',
|
|
|
- `agent_key_id` BIGINT(20) NOT NULL,
|
|
|
+ `agent_key_id` BIGINT(20) NOT NULL,
|
|
|
PRIMARY KEY (`agent_id`)
|
|
|
) COMMENT ='agent'
|
|
|
;
|
|
|
@@ -101,7 +101,7 @@ CREATE TABLE `it_monitor_agent`
|
|
|
drop TABLE if exists it_monitor_agent_key;
|
|
|
CREATE TABLE `it_monitor_agent_key`
|
|
|
(
|
|
|
- `agent_key_id` BIGINT(20) NOT NULL AUTO_INCREMENT,
|
|
|
+ `agent_key_id` BIGINT(20) NOT NULL AUTO_INCREMENT,
|
|
|
`key` VARCHAR(255) NOT NULL,
|
|
|
`remark` VARCHAR(255) NOT NULL,
|
|
|
PRIMARY KEY (`agent_key_id`)
|
|
|
@@ -114,11 +114,11 @@ CREATE TABLE `it_monitor_alarm`
|
|
|
`alarm_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '告警ID',
|
|
|
`item_id` BIGINT(20) NOT NULL COMMENT '指标ID',
|
|
|
`resource_id` BIGINT(20) NOT NULL COMMENT '资源ID',
|
|
|
- `alarm_txt` TEXT NOT NULL COMMENT '告警内容',
|
|
|
- `alarm_type` INT(11) NOT NULL COMMENT '告警级别',
|
|
|
- `alarm_status` INT(11) NOT NULL DEFAULT '0' COMMENT '告警状态:0未处理;1已恢复;2已处理',
|
|
|
- `first_alarm_time` TIMESTAMP NOT NULL COMMENT '初次告警时间',
|
|
|
- `alarm_times` INT(11) NOT NULL DEFAULT '0' COMMENT '连续告警次数',
|
|
|
+ `alarm_txt` TEXT NOT NULL COMMENT '告警内容',
|
|
|
+ `alarm_type` INT(11) NOT NULL COMMENT '告警级别',
|
|
|
+ `alarm_status` INT(11) NOT NULL DEFAULT '0' COMMENT '告警状态:0未处理;1已恢复;2已处理',
|
|
|
+ `first_alarm_time` TIMESTAMP NOT NULL COMMENT '初次告警时间',
|
|
|
+ `alarm_times` INT(11) NOT NULL DEFAULT '0' COMMENT '连续告警次数',
|
|
|
`update_user_id` BIGINT(20) NOT NULL DEFAULT '-1' COMMENT '最后更新用户ID',
|
|
|
PRIMARY KEY (`alarm_id`)
|
|
|
) COMMENT ='监控-告警'
|
|
|
@@ -129,8 +129,8 @@ CREATE TABLE `it_monitor_data`
|
|
|
(
|
|
|
`resource_id` BIGINT(20) NOT NULL,
|
|
|
`item_id` BIGINT(20) NOT NULL,
|
|
|
- `record_time` TIMESTAMP NOT NULL,
|
|
|
- `data` TEXT NOT NULL,
|
|
|
+ `record_time` TIMESTAMP NOT NULL,
|
|
|
+ `data` TEXT NOT NULL,
|
|
|
PRIMARY KEY (`resource_id`, `item_id`, `record_time`)
|
|
|
) COMMENT ='监控-数据'
|
|
|
;
|
|
|
@@ -138,11 +138,11 @@ CREATE TABLE `it_monitor_data`
|
|
|
drop TABLE if exists it_monitor_item;
|
|
|
CREATE TABLE `it_monitor_item`
|
|
|
(
|
|
|
- `item_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '指标ID',
|
|
|
+ `item_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '指标ID',
|
|
|
`item_name` VARCHAR(255) NOT NULL COMMENT '指标名称',
|
|
|
`item_key_name` VARCHAR(255) NOT NULL COMMENT '指标key',
|
|
|
- `item_group_id` BIGINT(20) NOT NULL COMMENT '指标组ID',
|
|
|
- `item_type` INT(11) NOT NULL COMMENT '指标类型:0文本,1纯数字,2百分比,3大小(除文本外都是数字大类,前端进行细分)',
|
|
|
+ `item_group_id` BIGINT(20) NOT NULL COMMENT '指标组ID',
|
|
|
+ `item_type` INT(11) NOT NULL COMMENT '指标类型:0文本,1纯数字,2百分比,3大小(除文本外都是数字大类,前端进行细分)',
|
|
|
PRIMARY KEY (`item_id`),
|
|
|
UNIQUE INDEX `item_key_name` (`item_key_name`)
|
|
|
) COMMENT ='监控指标'
|
|
|
@@ -151,11 +151,12 @@ CREATE TABLE `it_monitor_item`
|
|
|
drop TABLE if exists it_monitor_item_group;
|
|
|
CREATE TABLE `it_monitor_item_group`
|
|
|
(
|
|
|
- `group_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '组ID',
|
|
|
+ `group_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '组ID',
|
|
|
`group_name` VARCHAR(255) NOT NULL COMMENT '组名',
|
|
|
- `template_id` BIGINT(20) NOT NULL COMMENT '所属模板ID',
|
|
|
- `interval` INT(11) NOT NULL COMMENT '间隔',
|
|
|
- `top_item_id` BIGINT(20) NOT NULL DEFAULT '-1' COMMENT '置顶指标',
|
|
|
+ `template_id` BIGINT(20) NOT NULL COMMENT '所属模板ID',
|
|
|
+ `interval` INT(11) NOT NULL COMMENT '间隔',
|
|
|
+ `top_item_id` BIGINT(20) NOT NULL DEFAULT '-1' COMMENT '置顶指标',
|
|
|
+ `is_table` TINYINT(11) NOT NULL,
|
|
|
PRIMARY KEY (`group_id`)
|
|
|
) COMMENT ='监控指标组'
|
|
|
;
|
|
|
@@ -163,10 +164,10 @@ CREATE TABLE `it_monitor_item_group`
|
|
|
drop TABLE if exists it_monitor_resource;
|
|
|
CREATE TABLE `it_monitor_resource`
|
|
|
(
|
|
|
- `resource_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '资源ID',
|
|
|
- `template_id` BIGINT(20) NOT NULL COMMENT '模板ID',
|
|
|
- `agent_id` BIGINT(20) NOT NULL COMMENT 'Agent ID',
|
|
|
- `resource_group_id` BIGINT(20) NOT NULL COMMENT '资源组ID',
|
|
|
+ `resource_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '资源ID',
|
|
|
+ `template_id` BIGINT(20) NOT NULL COMMENT '模板ID',
|
|
|
+ `agent_id` BIGINT(20) NOT NULL COMMENT 'Agent ID',
|
|
|
+ `resource_group_id` BIGINT(20) NOT NULL COMMENT '资源组ID',
|
|
|
`resource_name` VARCHAR(255) NOT NULL COMMENT '资源名称',
|
|
|
PRIMARY KEY (`resource_id`)
|
|
|
) COMMENT ='监控-资源表'
|
|
|
@@ -175,7 +176,7 @@ CREATE TABLE `it_monitor_resource`
|
|
|
drop TABLE if exists it_monitor_resource_group;
|
|
|
CREATE TABLE `it_monitor_resource_group`
|
|
|
(
|
|
|
- `group_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '组ID',
|
|
|
+ `group_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '组ID',
|
|
|
`group_name` VARCHAR(255) NOT NULL COMMENT '组名',
|
|
|
PRIMARY KEY (`group_id`)
|
|
|
) COMMENT ='监控-资源组'
|
|
|
@@ -184,7 +185,7 @@ CREATE TABLE `it_monitor_resource_group`
|
|
|
drop TABLE if exists it_monitor_template;
|
|
|
CREATE TABLE `it_monitor_template`
|
|
|
(
|
|
|
- `template_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '模板ID',
|
|
|
+ `template_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '模板ID',
|
|
|
`template_name` VARCHAR(255) NOT NULL COMMENT '模板名称',
|
|
|
PRIMARY KEY (`template_id`)
|
|
|
) COMMENT ='监控模板'
|
|
|
@@ -193,12 +194,12 @@ CREATE TABLE `it_monitor_template`
|
|
|
drop TABLE if exists it_monitor_threshold;
|
|
|
CREATE TABLE `it_monitor_threshold`
|
|
|
(
|
|
|
- `item_id` BIGINT(20) NOT NULL COMMENT '指标ID',
|
|
|
- `resource_id` BIGINT(20) NOT NULL COMMENT '资源ID',
|
|
|
- `alarm_type` INT(11) NOT NULL COMMENT '告警级别',
|
|
|
- `threshold_type` INT(11) NOT NULL COMMENT '阈值类型:0发生变化;1大于;2小于;3大于等于;4小于等于;5等于;6不等于;7包含;8不包含',
|
|
|
+ `item_id` BIGINT(20) NOT NULL COMMENT '指标ID',
|
|
|
+ `resource_id` BIGINT(20) NOT NULL COMMENT '资源ID',
|
|
|
+ `alarm_type` INT(11) NOT NULL COMMENT '告警级别',
|
|
|
+ `threshold_type` INT(11) NOT NULL COMMENT '阈值类型:0发生变化;1大于;2小于;3大于等于;4小于等于;5等于;6不等于;7包含;8不包含',
|
|
|
`threshold` VARCHAR(255) NOT NULL COMMENT '阈值',
|
|
|
- `times` INT(11) NOT NULL COMMENT '连续触发次数',
|
|
|
+ `times` INT(11) NOT NULL COMMENT '连续触发次数',
|
|
|
PRIMARY KEY (`item_id`, `resource_id`)
|
|
|
) COMMENT ='监控-阈值'
|
|
|
;
|