schema.sql 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. use usthe;
  2. -- ----------------------------
  3. -- Table structure for monitor
  4. -- ----------------------------
  5. DROP TABLE IF EXISTS monitor ;
  6. CREATE TABLE monitor
  7. (
  8. id bigint not null auto_increment comment '监控ID',
  9. job_id bigint not null comment '监控对应下发的任务ID',
  10. name varchar(100) not null comment '监控的名称',
  11. app varchar(100) not null comment '监控的类型:linux,mysql,jvm...',
  12. host varchar(100) not null comment '监控的对端host:ipv4,ipv6,域名',
  13. intervals int not null default 600 comment '监控的采集间隔时间,单位秒',
  14. status tinyint not null default 1 comment '监控状态 0:未监控,1:可用,2:不可用,3:不可达,4:挂起',
  15. description varchar(255) comment '描述备注信息',
  16. creator varchar(100) comment '创建者',
  17. modifier varchar(100) comment '最新修改者',
  18. gmt_create timestamp default current_timestamp comment 'create time',
  19. gmt_update datetime default current_timestamp on update current_timestamp comment 'update time',
  20. primary key (id),
  21. index query_index (app, host, name)
  22. ) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4;
  23. -- ----------------------------
  24. -- Table structure for param
  25. -- ----------------------------
  26. DROP TABLE IF EXISTS param ;
  27. CREATE TABLE param
  28. (
  29. id bigint not null auto_increment comment '参数ID',
  30. monitor_id bigint not null comment '监控ID',
  31. field varchar(100) not null comment '参数标识符',
  32. value varchar(255) not null comment '参数值,最大字符长度255',
  33. type tinyint not null default 0 comment '参数类型 0:数字 1:字符串 2:加密串',
  34. gmt_create timestamp default current_timestamp comment 'create time',
  35. gmt_update datetime default current_timestamp on update current_timestamp comment 'update time',
  36. primary key (id),
  37. index monitor_id (monitor_id),
  38. unique key unique_param (monitor_id, field)
  39. ) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4;
  40. -- ----------------------------
  41. -- Table structure for param
  42. -- ----------------------------
  43. DROP TABLE IF EXISTS param_define ;
  44. CREATE TABLE param_define
  45. (
  46. id bigint not null auto_increment comment '参数ID',
  47. app varchar(100) not null comment '监控的类型:linux,mysql,jvm...',
  48. name varchar(100) not null comment '参数字段对外显示名称',
  49. field varchar(100) not null comment '参数字段标识符',
  50. type varchar(20) not null default 'text' comment '字段类型,样式(大部分映射input标签type属性)',
  51. param_range varchar(100) not null comment '当type为number时,用range表示范围 eg: 0-233',
  52. param_limit tinyint unsigned not null comment '当type为text时,用limit表示字符串限制大小.最大255',
  53. param_option varchar(255) not null comment '当type为radio单选框,checkbox复选框时,option表示可选项值列表',
  54. creator varchar(100) comment '创建者',
  55. modifier varchar(100) comment '最新修改者',
  56. gmt_create timestamp default current_timestamp comment 'create time',
  57. gmt_update datetime default current_timestamp on update current_timestamp comment 'update time',
  58. primary key (id),
  59. unique key unique_param_define (app, field)
  60. ) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4;