You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

n9e_mon.sql 13 kB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. set names utf8;
  2. drop database if exists n9e_mon;
  3. create database n9e_mon;
  4. use n9e_mon;
  5. CREATE TABLE `node` (
  6. `id` int unsigned not null AUTO_INCREMENT,
  7. `pid` int unsigned not null,
  8. `name` varchar(64) not null,
  9. `path` varchar(255) not null,
  10. `leaf` int(1) not null,
  11. `note` varchar(128) not null default '',
  12. PRIMARY KEY (`id`),
  13. KEY (`path`)
  14. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  15. CREATE TABLE `endpoint` (
  16. `id` int unsigned not null AUTO_INCREMENT,
  17. `ident` varchar(255) not null,
  18. `alias` varchar(255) not null default '',
  19. PRIMARY KEY (`id`),
  20. UNIQUE KEY (`ident`),
  21. KEY (`alias`)
  22. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  23. CREATE TABLE `node_endpoint` (
  24. `node_id` int unsigned not null,
  25. `endpoint_id` int unsigned not null,
  26. KEY(`node_id`),
  27. KEY(`endpoint_id`)
  28. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  29. create table `maskconf` (
  30. `id` int unsigned not null auto_increment,
  31. `nid` int unsigned not null,
  32. `metric` varchar(255) not null,
  33. `tags` varchar(255) not null default '',
  34. `cause` varchar(255) not null default '',
  35. `user` varchar(32) not null default 'operate user',
  36. `btime` bigint not null default 0 comment 'begin time',
  37. `etime` bigint not null default 0 comment 'end time',
  38. primary key (`id`),
  39. key(`nid`)
  40. ) engine=innodb default charset=utf8;
  41. create table `maskconf_endpoints` (
  42. `id` int unsigned not null auto_increment,
  43. `mask_id` int unsigned not null,
  44. `endpoint` varchar(255) not null,
  45. primary key (`id`),
  46. key(`mask_id`)
  47. ) engine=innodb default charset=utf8;
  48. create table `screen` (
  49. `id` int unsigned not null auto_increment,
  50. `node_id` int unsigned not null comment 'service tree node id',
  51. `name` varchar(255) not null,
  52. `last_updator` varchar(64) not null default '',
  53. `last_updated` timestamp not null default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  54. primary key (`id`),
  55. key(`node_id`)
  56. ) engine=innodb default charset=utf8;
  57. create table `screen_subclass` (
  58. `id` int unsigned not null auto_increment,
  59. `screen_id` int unsigned not null,
  60. `name` varchar(255) not null,
  61. `weight` int not null default 0,
  62. primary key (`id`),
  63. key(`screen_id`)
  64. ) engine=innodb default charset=utf8;
  65. create table `chart` (
  66. `id` int unsigned not null auto_increment,
  67. `subclass_id` int unsigned not null,
  68. `configs` varchar(8192),
  69. `weight` int not null default 0,
  70. primary key (`id`),
  71. key(`subclass_id`)
  72. ) engine=innodb default charset=utf8;
  73. create table `tmp_chart` (
  74. `id` int unsigned not null auto_increment,
  75. `configs` varchar(8192),
  76. `creator` varchar(64) not null,
  77. `last_updated` timestamp not null default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  78. primary key (`id`)
  79. ) engine=innodb default charset=utf8;
  80. create table `event_cur` (
  81. `id` bigint(20) unsigned not null AUTO_INCREMENT comment 'id',
  82. `sid` bigint(20) unsigned not null default 0 comment 'sid',
  83. `sname` varchar(255) not null default '' comment 'name, 报警通知名称',
  84. `node_path` varchar(255) not null default '' comment 'node path',
  85. `nid` int unsigned not null default '0' comment 'node id',
  86. `endpoint` varchar(255) not null default '' comment 'endpoint',
  87. `endpoint_alias` varchar(255) not null default '' comment 'endpoint alias',
  88. `priority` tinyint(4) not null default 2 comment '优先级',
  89. `event_type` varchar(45) not null default '' comment 'alert|recovery',
  90. `category` tinyint(4) not null default 2 comment '1阈值 2智能',
  91. `status` int(10) not null default 0 comment 'event status',
  92. `detail` text comment 'counter points pred_points 详情',
  93. `hashid` varchar(128) not null default '' comment 'sid+counter hash',
  94. `etime` bigint(20) not null default 0 comment 'event ts',
  95. `value` varchar(255) not null default '' comment '当前值',
  96. `users` varchar(512) not null default '[]' comment 'notify users',
  97. `groups` varchar(512) not null default '[]' comment 'notify groups',
  98. `info` varchar(512) not null default '' comment 'strategy info',
  99. `ignore_alert` int(2) not null default 0 comment 'ignore event',
  100. `claimants` varchar(512) not null default '[]' comment 'claimants',
  101. `need_upgrade` int(2) not null default 0 comment 'need upgrade',
  102. `alert_upgrade` text comment 'alert upgrade',
  103. `created` DATETIME not null default '1971-1-1 00:00:00' comment 'created',
  104. KEY `idx_id` (`id`),
  105. KEY `idx_sid` (`sid`),
  106. KEY `idx_hashid` (`hashid`),
  107. KEY `idx_node_path` (`node_path`),
  108. KEY `idx_etime` (`etime`)
  109. ) engine=innodb default charset=utf8 comment 'event';
  110. create table `event` (
  111. `id` bigint(20) unsigned not null AUTO_INCREMENT comment 'id',
  112. `sid` bigint(20) unsigned not null default 0 comment 'sid',
  113. `sname` varchar(255) not null default '' comment 'name, 报警通知名称',
  114. `node_path` varchar(255) not null default '' comment 'node path',
  115. `nid` int unsigned not null default '0' comment 'node id',
  116. `endpoint` varchar(255) not null default '' comment 'endpoint',
  117. `endpoint_alias` varchar(255) not null default '' comment 'endpoint alias',
  118. `priority` tinyint(4) not null default 2 comment '优先级',
  119. `event_type` varchar(45) not null default '' comment 'alert|recovery',
  120. `category` tinyint(4) not null default 2 comment '1阈值 2智能',
  121. `status` int(10) not null default 0 comment 'event status',
  122. `detail` text comment 'counter points pred_points 详情',
  123. `hashid` varchar(128) not null default '' comment 'sid+counter hash',
  124. `etime` bigint(20) not null default 0 comment 'event ts',
  125. `value` varchar(255) not null default '' comment '当前值',
  126. `users` varchar(512) not null default '[]' comment 'notify users',
  127. `groups` varchar(512) not null default '[]' comment 'notify groups',
  128. `info` varchar(512) not null default '' comment 'strategy info',
  129. `need_upgrade` int(2) not null default 0 comment 'need upgrade',
  130. `alert_upgrade` text not null comment 'alert upgrade',
  131. `created` DATETIME not null default '1971-1-1 00:00:00' comment 'created',
  132. PRIMARY KEY (`id`),
  133. KEY `idx_id` (`id`),
  134. KEY `idx_sid` (`sid`),
  135. KEY `idx_hashid` (`hashid`),
  136. KEY `idx_node_path` (`node_path`),
  137. KEY `idx_etime` (`etime`),
  138. KEY `idx_event_type` (`event_type`),
  139. KEY `idx_status` (`status`)
  140. ) engine=innodb default charset=utf8 comment 'event';
  141. CREATE TABLE `stra` (
  142. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  143. `name` varchar(255) NOT NULL COMMENT 'strategy name',
  144. `category` int(1) NOT NULL COMMENT '1 机器 2业务',
  145. `nid` int(10) NOT NULL COMMENT '服务树节点id',
  146. `excl_nid` varchar(255) NOT NULL COMMENT '被排除的服务树叶子节点id',
  147. `alert_dur` int(4) NOT NULL COMMENT '单位秒,持续异常n秒则产生异常event',
  148. `recovery_dur` int(4) NOT NULL DEFAULT 0 COMMENT '单位秒,持续正常n秒则产生恢复event,0表示立即产生恢复event',
  149. `exprs` varchar(1024) NOT NULL DEFAULT '' COMMENT '规则表达式',
  150. `tags` varchar(1024) DEFAULT '' COMMENT 'tags过滤',
  151. `enable_stime` varchar(6) NOT NULL DEFAULT '00:00' COMMENT '策略生效开始时间',
  152. `enable_etime` varchar(6) NOT NULL DEFAULT '23:59' COMMENT '策略生效终止时间',
  153. `enable_days_of_week` varchar(1024) NOT NULL DEFAULT '[0,1,2,3,4,5,6]' COMMENT '策略生效日期',
  154. `converge` varchar(45) NOT NULL DEFAULT '' COMMENT 'n秒最多报m次警',
  155. `recovery_notify` int(1) NOT NULL DEFAULT 1 COMMENT '1 发送恢复通知 0不发送恢复通知',
  156. `priority` int(1) NOT NULL DEFAULT 3 COMMENT '告警等级',
  157. `notify_group` varchar(255) NOT NULL DEFAULT '' COMMENT '告警通知组',
  158. `notify_user` varchar(255) NOT NULL DEFAULT '' COMMENT '告警通知人',
  159. `callback` varchar(1024) NOT NULL DEFAULT '' COMMENT 'callback url',
  160. `creator` varchar(64) NOT NULL COMMENT '创建者',
  161. `created` timestamp NOT NULL DEFAULT '1971-01-01 00:00:00' COMMENT 'created',
  162. `last_updator` varchar(64) NOT NULL DEFAULT '',
  163. `last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  164. `need_upgrade` int(2) not null default 0 comment 'need upgrade',
  165. `alert_upgrade` text comment 'alert upgrade',
  166. PRIMARY KEY (`id`),
  167. KEY `idx_nid` (`nid`)
  168. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  169. CREATE TABLE `stra_log` (
  170. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  171. `sid` bigint(20) NOT NULL DEFAULT '0' COMMENT 'collect id',
  172. `action` varchar(255) NOT NULL DEFAULT '' COMMENT '动作 update, delete',
  173. `body` text COMMENT '修改之前采集的内容',
  174. `creator` varchar(255) NOT NULL DEFAULT '1971-01-01 00:00:00' COMMENT 'creator',
  175. `created` timestamp NOT NULL DEFAULT '1971-01-01 00:00:00' COMMENT 'created',
  176. PRIMARY KEY (`id`),
  177. KEY `idx_sid` (`sid`)
  178. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  179. CREATE TABLE `port_collect` (
  180. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  181. `collect_type` varchar(64) NOT NULL DEFAULT 'PORT' COMMENT 'type',
  182. `nid` int(10) NOT NULL COMMENT '服务树节点id',
  183. `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name',
  184. `tags` varchar(255) NOT NULL DEFAULT '' COMMENT 'tags',
  185. `port` int(11) NOT NULL DEFAULT '0' COMMENT 'port',
  186. `step` int(11) NOT NULL DEFAULT '0' COMMENT '采集周期',
  187. `timeout` int(11) NOT NULL DEFAULT '0' COMMENT 'connect time',
  188. `comment` varchar(512) NOT NULL DEFAULT '' COMMENT 'comment',
  189. `creator` varchar(255) NOT NULL DEFAULT '' COMMENT 'creator',
  190. `created` datetime NOT NULL COMMENT 'created',
  191. `last_updator` varchar(255) NOT NULL DEFAULT '' COMMENT 'last_updator',
  192. `last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'last_updated',
  193. PRIMARY KEY (`id`),
  194. KEY `idx_nid` (`nid`),
  195. KEY `idx_collect_type` (`collect_type`)
  196. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'port collect';
  197. CREATE TABLE `proc_collect` (
  198. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  199. `nid` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'nid',
  200. `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name',
  201. `tags` varchar(255) NOT NULL DEFAULT '' COMMENT 'tags',
  202. `collect_type` varchar(64) NOT NULL DEFAULT 'PROC' COMMENT 'type',
  203. `collect_method` varchar(64) NOT NULL DEFAULT 'name' COMMENT '采集方式',
  204. `target` varchar(255) NOT NULL DEFAULT '' COMMENT '采集对象',
  205. `step` int(11) NOT NULL DEFAULT '0' COMMENT '采集周期',
  206. `comment` varchar(512) NOT NULL DEFAULT '' COMMENT 'comment',
  207. `creator` varchar(255) NOT NULL DEFAULT '' COMMENT 'creator',
  208. `created` datetime NOT NULL COMMENT 'created',
  209. `last_updator` varchar(255) NOT NULL DEFAULT '' COMMENT 'last_updator',
  210. `last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  211. PRIMARY KEY (`id`),
  212. KEY `idx_nid` (`nid`),
  213. KEY `idx_collect_type` (`collect_type`)
  214. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'proc collect';
  215. CREATE TABLE `log_collect` (
  216. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  217. `nid` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'nid',
  218. `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name',
  219. `tags` varchar(255) NOT NULL DEFAULT '' COMMENT 'tags',
  220. `collect_type` varchar(64) NOT NULL DEFAULT 'PROC' COMMENT 'type',
  221. `step` int(11) NOT NULL DEFAULT '0' COMMENT '采集周期',
  222. `file_path` varchar(255) NOT NULL DEFAULT '' COMMENT 'file path',
  223. `time_format` varchar(128) NOT NULL DEFAULT '' COMMENT 'time format',
  224. `pattern` varchar(1024) NOT NULL DEFAULT '' COMMENT 'pattern',
  225. `func` varchar(64) NOT NULL DEFAULT '' COMMENT 'func',
  226. `degree` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'degree',
  227. `func_type` varchar(64) NOT NULL DEFAULT '' COMMENT 'func_type',
  228. `aggregate` varchar(64) NOT NULL DEFAULT '' COMMENT 'aggr',
  229. `unit` varchar(64) NOT NULL DEFAULT '' COMMENT 'unit',
  230. `zero_fill` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'zero fill',
  231. `comment` varchar(512) NOT NULL DEFAULT '' COMMENT 'comment',
  232. `creator` varchar(255) NOT NULL DEFAULT '' COMMENT 'creator',
  233. `created` datetime NOT NULL COMMENT 'created',
  234. `last_updator` varchar(255) NOT NULL DEFAULT '' COMMENT 'last_updator',
  235. `last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  236. PRIMARY KEY (`id`),
  237. KEY `idx_nid` (`nid`),
  238. KEY `idx_collect_type` (`collect_type`)
  239. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'log collect';
  240. CREATE TABLE `collect_hist` (
  241. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  242. `cid` bigint(20) NOT NULL DEFAULT '0' COMMENT 'collect id',
  243. `collect_type` varchar(255) NOT NULL DEFAULT '' COMMENT '采集的种类 log,port,proc,plugin',
  244. `action` varchar(255) NOT NULL DEFAULT '' COMMENT '动作 update, delete',
  245. `body` text COMMENT '修改之前采集的内容',
  246. `creator` varchar(255) NOT NULL DEFAULT '1971-01-01 00:00:00' COMMENT 'creator',
  247. `created` datetime NOT NULL DEFAULT '1971-01-01 00:00:00' COMMENT 'created',
  248. PRIMARY KEY (`id`),
  249. KEY `idx_cid` (`cid`)
  250. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'hist';